Date: (Sun) Jun 12, 2016

Introduction:

Data: Source: Training: “https://inclass.kaggle.com/c/can-we-predict-voting-outcomes/download/train2016.csv
New: “https://inclass.kaggle.com/c/can-we-predict-voting-outcomes/download/test2016.csv
Time period:

Synopsis:

Based on analysis utilizing <> techniques, :

Summary of key steps & error improvement stats:

Prediction Accuracy Enhancement Options:

  • transform.data chunk:
    • derive features from multiple features
  • manage.missing.data chunk:
    • Not fill missing vars
    • Fill missing numerics with a different algorithm
    • Fill missing chars with data based on clusters

[](.png)

Potential next steps include:

  • Organization:
    • Categorize by chunk
    • Priority criteria:
      1. Ease of change
      2. Impacts report
      3. Cleans innards
      4. Bug report
  • all chunks:
    • at chunk-end rm(!glb_)
  • manage.missing.data chunk:
    • cleaner way to manage re-splitting of training vs. new entity
  • extract.features chunk:
    • Add n-grams for glbFeatsText
      • “RTextTools”, “tau”, “RWeka”, and “textcat” packages
  • fit.models chunk:
    • Classification: Plot AUC Curves for all models & highlight glbMdlSel
    • Prediction accuracy scatter graph:
    • Add tiles (raw vs. PCA)
    • Use shiny for drop-down of “important” features
    • Use plot.ly for interactive plots ?

    • Change .fit suffix of model metrics to .mdl if it’s data independent (e.g. AIC, Adj.R.Squared - is it truly data independent ?, etc.)
    • create a custom model for rpart that has minbucket as a tuning parameter
    • varImp for randomForest crashes in caret version:6.0.41 -> submit bug report

  • Probability handling for multinomials vs. desired binomial outcome
  • ROCR currently supports only evaluation of binary classification tasks (version 1.0.7)
  • extensions toward multiclass classification are scheduled for the next release

  • fit.all.training chunk:
    • myplot_prediction_classification: displays ‘x’ instead of ‘+’ when there are no prediction errors
  • Compare glb_sel_mdl vs. glb_fin_mdl:
    • varImp
    • Prediction differences (shd be minimal ?)
  • Move glb_analytics_diag_plots to mydsutils.R: (+) Easier to debug (-) Too many glb vars used
  • Add print(ggplot.petrinet(glb_analytics_pn) + coord_flip()) at the end of every major chunk
  • Parameterize glb_analytics_pn
  • Move glb_impute_missing_data to mydsutils.R: (-) Too many glb vars used; glb_<>_df reassigned
  • Do non-glm methods handle interaction terms ?
  • f-score computation for classifiers should be summation across outcomes (not just the desired one ?)
  • Add accuracy computation to glb_dmy_mdl in predict.data.new chunk
  • Why does splitting fit.data.training.all chunk into separate chunks add an overhead of ~30 secs ? It’s not rbind b/c other chunks have lower elapsed time. Is it the number of plots ?
  • Incorporate code chunks in print_sessionInfo
  • Test against
    • projects in github.com/bdanalytics
    • lectures in jhu-datascience track

Analysis:

rm(list = ls())
set.seed(12345)
options(stringsAsFactors = FALSE)
source("~/Dropbox/datascience/R/mycaret.R")
source("~/Dropbox/datascience/R/mypetrinet.R")
source("~/Dropbox/datascience/R/myplclust.R")
source("~/Dropbox/datascience/R/myplot.R")
source("~/Dropbox/datascience/R/myscript.R")
source("~/Dropbox/datascience/R/mytm.R")
if (is.null(knitr::opts_current$get(name = 'label'))) # Running in IDE
    debugSource("~/Dropbox/datascience/R/mydsutils.R") else
    source("~/Dropbox/datascience/R/mydsutils.R")    
## Loading required package: caret
## Loading required package: lattice
# Gather all package requirements here
suppressPackageStartupMessages(require(doMC))
glbCores <- 10 # of cores on machine - 2
registerDoMC(glbCores) 

suppressPackageStartupMessages(require(caret))
require(plyr)
## Loading required package: plyr
require(dplyr)
## Loading required package: dplyr
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:plyr':
## 
##     arrange, count, desc, failwith, id, mutate, rename, summarise,
##     summarize
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
require(knitr)
## Loading required package: knitr
require(stringr)
## Loading required package: stringr
#source("dbgcaret.R")
#packageVersion("snow")
#require(sos); findFn("cosine", maxPages=2, sortby="MaxScore")

# Analysis control global variables
# Inputs
#   url/name = "<PathPointer>"; if url specifies a zip file, name = "<filename>"; 
#               or named collection of <PathPointer>s
#   sep = choose from c(NULL, "\t")
glbObsTrnFile <- list(url = "https://inclass.kaggle.com/c/can-we-predict-voting-outcomes/download/train2016.csv"
    # or list(url = c(NULL, <.inp1> = "<path1>", <.inp2> = "<path2>"))
    #, splitSpecs = list(method = "copy" # default when glbObsNewFile is NULL
    #                       select from c("copy", NULL ???, "condition", "sample", )
    #                      ,nRatio = 0.3 # > 0 && < 1 if method == "sample" 
    #                      ,seed = 123 # any integer or glbObsTrnPartitionSeed if method == "sample" 
    #                      ,condition = # or 'is.na(<var>)'; '<var> <condition_operator> <value>'    
    #                      )
    )                   
 
glbObsNewFile <- list(url = "https://inclass.kaggle.com/c/can-we-predict-voting-outcomes/download/test2016.csv") 

glbObsDropCondition <- #NULL # : default
#   enclose in single-quotes b/c condition might include double qoutes
#       use | & ; NOT || &&    
#   '<condition>' 
    # 'grepl("^First Draft Video:", glbObsAll$Headline)'
    # 'is.na(glbObsAll[, glb_rsp_var_raw])'
    # '(is.na(glbObsAll[, glb_rsp_var_raw]) & grepl("Train", glbObsAll[, glbFeatsId]))'
    # 'is.na(strptime(glbObsAll[, "Date"], glbFeatsDateTime[["Date"]]["format"], tz = glbFeatsDateTime[["Date"]]["timezone"]))'
'(is.na(glbObsAll[, "Q109244"]) | (glbObsAll[, "Q109244"] != "No"))'
#nrow(do.call("subset",list(glbObsAll, parse(text=paste0("!(", glbObsDropCondition, ")")))))
    
glb_obs_repartition_train_condition <- NULL # : default
#    "<condition>" 

glb_max_fitobs <- NULL # or any integer
glbObsTrnPartitionSeed <- 123 # or any integer
                         
glb_is_regression <- FALSE; glb_is_classification <- !glb_is_regression; 
    glb_is_binomial <- TRUE # or TRUE or FALSE

glb_rsp_var_raw <- "Party"

# for classification, the response variable has to be a factor
glb_rsp_var <- "Party.fctr"

# if the response factor is based on numbers/logicals e.g (0/1 OR TRUE/FALSE vs. "A"/"B"), 
#   or contains spaces (e.g. "Not in Labor Force")
#   caret predict(..., type="prob") crashes
glb_map_rsp_raw_to_var <- #NULL 
function(raw) {
#     return(raw ^ 0.5)
#     return(log(raw))
#     return(log(1 + raw))
#     return(log10(raw)) 
#     return(exp(-raw / 2))
#     
# chk ref value against frequencies vs. alpha sort order
    ret_vals <- rep_len(NA, length(raw)); ret_vals[!is.na(raw)] <- ifelse(raw[!is.na(raw)] == "Republican", "R", "D"); return(relevel(as.factor(ret_vals), ref = "D")) 
    
#     as.factor(paste0("B", raw))
#     as.factor(gsub(" ", "\\.", raw))
    }

#if glb_rsp_var_raw is numeric:
#print(summary(glbObsAll[, glb_rsp_var_raw]))
#glb_map_rsp_raw_to_var(tst <- c(NA, as.numeric(summary(glbObsAll[, glb_rsp_var_raw])))) 

#if glb_rsp_var_raw is character:
#print(table(glbObsAll[, glb_rsp_var_raw], useNA = "ifany"))
# print(table(glb_map_rsp_raw_to_var(tst <- glbObsAll[, glb_rsp_var_raw]), useNA = "ifany"))

glb_map_rsp_var_to_raw <- #NULL 
function(var) {
#     return(var ^ 2.0)
#     return(exp(var))
#     return(10 ^ var) 
#     return(-log(var) * 2)
#     as.numeric(var)
#     levels(var)[as.numeric(var)]
    sapply(levels(var)[as.numeric(var)], function(elm) 
        if (is.na(elm)) return(elm) else
        if (elm == 'R') return("Republican") else
        if (elm == 'D') return("Democrat") else
        stop("glb_map_rsp_var_to_raw: unexpected value: ", elm)
        )  
#     gsub("\\.", " ", levels(var)[as.numeric(var)])
#     c("<=50K", " >50K")[as.numeric(var)]
#     c(FALSE, TRUE)[as.numeric(var)]
}
# print(table(glb_map_rsp_var_to_raw(glb_map_rsp_raw_to_var(tst)), useNA = "ifany"))

if ((glb_rsp_var != glb_rsp_var_raw) && is.null(glb_map_rsp_raw_to_var))
    stop("glb_map_rsp_raw_to_var function expected")

# List info gathered for various columns
# <col_name>:   <description>; <notes>
# USER_ID - an anonymous id unique to a given user
# YOB - the year of birth of the user
# Gender - the gender of the user, either Male or Female
# Income - the household income of the user. Either not provided, or one of "under $25,000", "$25,001 - $50,000", "$50,000 - $74,999", "$75,000 - $100,000", "$100,001 - $150,000", or "over $150,000".
# HouseholdStatus - the household status of the user. Either not provided, or one of "Domestic Partners (no kids)", "Domestic Partners (w/kids)", "Married (no kids)", "Married (w/kids)", "Single (no kids)", or "Single (w/kids)".
# EducationalLevel - the education level of the user. Either not provided, or one of "Current K-12", "High School Diploma", "Current Undergraduate", "Associate's Degree", "Bachelor's Degree", "Master's Degree", or "Doctoral Degree".
# Party - the political party for whom the user intends to vote for. Either "Democrat" or "Republican
# Q124742, Q124122, . . . , Q96024 - 101 different questions that the users were asked on Show of Hands. If the user didn't answer the question, there is a blank. For information about the question text and possible answers, see the file Questions.pdf.

# currently does not handle more than 1 column; consider concatenating multiple columns
# If glbFeatsId == NULL, ".rownames <- as.numeric(row.names())" is the default
glbFeatsId <- "USER_ID" # choose from c(NULL : default, "<id_feat>") 
# glbFeatsCategory <- "Hhold.fctr" # choose from c(NULL : default, "<category_feat>")
# glbFeatsCategory <- "Q109244.fctr" # choose from c(NULL : default, "<category_feat>") 
glbFeatsCategory <- "Q115611.fctr" # choose from c(NULL : default, "<category_feat>")

# User-specified exclusions
glbFeatsExclude <- c(NULL
#   Feats that shd be excluded due to known causation by prediction variable
# , "<feat1", "<feat2>"
#   Feats that are factors with unique values (as % of nObs) > 49 (empirically derived)
#   Feats that are linear combinations (alias in glm)
#   Feature-engineering phase -> start by excluding all features except id & category & 
#       work each one in
    , "USER_ID", "YOB", "Gender", "Income", "HouseholdStatus", "EducationLevel" 
    ,"Q124742","Q124122" 
    ,"Q123621","Q123464"
    ,"Q122771","Q122770","Q122769","Q122120"
    ,"Q121700","Q121699","Q121011"
    ,"Q120978","Q120650","Q120472","Q120379","Q120194","Q120014","Q120012" 
    ,"Q119851","Q119650","Q119334"
    ,"Q118892","Q118237","Q118233","Q118232","Q118117"
    ,"Q117193","Q117186"
    ,"Q116797","Q116881","Q116953","Q116601","Q116441","Q116448","Q116197"
    ,"Q115602","Q115777","Q115610","Q115611","Q115899","Q115390","Q115195"
    ,"Q114961","Q114748","Q114517","Q114386","Q114152"
    ,"Q113992","Q113583","Q113584","Q113181"
    ,"Q112478","Q112512","Q112270"
    ,"Q111848","Q111580","Q111220"
    ,"Q110740"
    ,"Q109367","Q109244"
    ,"Q108950","Q108855","Q108617","Q108856","Q108754","Q108342","Q108343"
    ,"Q107869","Q107491"
    ,"Q106993","Q106997","Q106272","Q106388","Q106389","Q106042"
    ,"Q105840","Q105655"
    ,"Q104996"
    ,"Q103293"
    ,"Q102906","Q102674","Q102687","Q102289","Q102089"
    ,"Q101162","Q101163","Q101596"
    ,"Q100689","Q100680","Q100562","Q100010"
    ,"Q99982"
    ,"Q99716"
    ,"Q99581"
    ,"Q99480"
    ,"Q98869"
    ,"Q98578"
    ,"Q98197"
    ,"Q98059","Q98078"
    ,"Q96024" # Done
    ,".pos") 
if (glb_rsp_var_raw != glb_rsp_var)
    glbFeatsExclude <- union(glbFeatsExclude, glb_rsp_var_raw)                    

glbFeatsInteractionOnly <- list()
#glbFeatsInteractionOnly[["<child_feat>"]] <- "<parent_feat>"
glbFeatsInteractionOnly[["YOB.Age.dff"]] <- "YOB.Age.fctr"

glbFeatsDrop <- c(NULL
                # , "<feat1>", "<feat2>"
                )

glb_map_vars <- NULL # or c("<var1>", "<var2>")
glb_map_urls <- list();
# glb_map_urls[["<var1>"]] <- "<var1.url>"

# Derived features; Use this mechanism to cleanse data ??? Cons: Data duplication ???
glbFeatsDerive <- list();

# glbFeatsDerive[["<feat.my.sfx>"]] <- list(
#     mapfn = function(<arg1>, <arg2>) { return(function(<arg1>, <arg2>)) } 
#   , args = c("<arg1>", "<arg2>"))
#myprint_df(data.frame(ImageId = mapfn(glbObsAll$.src, glbObsAll$.pos)))
#data.frame(ImageId = mapfn(glbObsAll$.src, glbObsAll$.pos))[7045:7055, ]

    # character
#     mapfn = function(Education) { raw <- Education; raw[is.na(raw)] <- "NA.my"; return(as.factor(raw)) } 
#     mapfn = function(Week) { return(substr(Week, 1, 10)) }
#     mapfn = function(Name) { return(sapply(Name, function(thsName) 
#                                             str_sub(unlist(str_split(thsName, ","))[1], 1, 1))) } 

#     mapfn = function(descriptor) { return(plyr::revalue(descriptor, c(
#         "ABANDONED BUILDING"  = "OTHER",
#         "**"                  = "**"
#                                           ))) }

#     mapfn = function(description) { mod_raw <- description;
    # This is here because it does not work if it's in txt_map_filename
#         mod_raw <- gsub(paste0(c("\n", "\211", "\235", "\317", "\333"), collapse = "|"), " ", mod_raw)
    # Don't parse for "." because of ".com"; use customized gsub for that text
#         mod_raw <- gsub("(\\w)(!|\\*|,|-|/)(\\w)", "\\1\\2 \\3", mod_raw);
    # Some state acrnoyms need context for separation e.g. 
    #   LA/L.A. could either be "Louisiana" or "LosAngeles"
        # modRaw <- gsub("\\bL\\.A\\.( |,|')", "LosAngeles\\1", modRaw);
    #   OK/O.K. could either be "Oklahoma" or "Okay"
#         modRaw <- gsub("\\bACA OK\\b", "ACA OKay", modRaw); 
#         modRaw <- gsub("\\bNow O\\.K\\.\\b", "Now OKay", modRaw);        
    #   PR/P.R. could either be "PuertoRico" or "Public Relations"        
        # modRaw <- gsub("\\bP\\.R\\. Campaign", "PublicRelations Campaign", modRaw);        
    #   VA/V.A. could either be "Virginia" or "VeteransAdministration"        
        # modRaw <- gsub("\\bthe V\\.A\\.\\:", "the VeteranAffairs:", modRaw);
    #   
    # Custom mods

#         return(mod_raw) }

    # numeric
# Create feature based on record position/id in data   
glbFeatsDerive[[".pos"]] <- list(
    mapfn = function(raw1) { return(1:length(raw1)) }
    , args = c(".rnorm"))
# glbFeatsDerive[[".pos.y"]] <- list(
#     mapfn = function(raw1) { return(1:length(raw1)) }       
#     , args = c(".rnorm"))    

# Add logs of numerics that are not distributed normally
#   Derive & keep multiple transformations of the same feature, if normality is hard to achieve with just one transformation
#   Right skew: logp1; sqrt; ^ 1/3; logp1(logp1); log10; exp(-<feat>/constant)
# glbFeatsDerive[["WordCount.log1p"]] <- list(
#     mapfn = function(WordCount) { return(log1p(WordCount)) } 
#   , args = c("WordCount"))
# glbFeatsDerive[["WordCount.root2"]] <- list(
#     mapfn = function(WordCount) { return(WordCount ^ (1/2)) } 
#   , args = c("WordCount"))
# glbFeatsDerive[["WordCount.nexp"]] <- list(
#     mapfn = function(WordCount) { return(exp(-WordCount)) } 
#   , args = c("WordCount"))
#print(summary(glbObsAll$WordCount))
#print(summary(mapfn(glbObsAll$WordCount)))
    
# If imputation shd be skipped for this feature
# glbFeatsDerive[["District.fctr"]] <- list(
#     mapfn = function(District) {
#         raw <- District;
#         ret_vals <- rep_len("NA", length(raw)); 
#         ret_vals[!is.na(raw)] <- sapply(raw[!is.na(raw)], function(elm) 
#                                         ifelse(elm < 10, "1-9", 
#                                         ifelse(elm < 20, "10-19", "20+")));
#         return(relevel(as.factor(ret_vals), ref = "NA"))
#     }       
#     , args = c("District"))    

# YOB options:
# 1. Missing data:
# 1.1   0 -> Does not improve baseline
# 1.2   Cut factors & "NA" is a level
# 2. Data corrections: < 1928 & > 2000
# 3. Scale YOB
# 4. Add Age
# YOB.Age.fctr needs to be synced with YOB.Age.dff; Create a separate sub-function ???
glbFeatsDerive[["YOB.Age.fctr"]] <- list(
    mapfn = function(raw1) {
        raw <- 2016 - raw1 
        # raw[!is.na(raw) & raw >= 2010] <- NA
        raw[!is.na(raw) & (raw <= 15)] <- NA
        raw[!is.na(raw) & (raw >= 90)] <- NA        
        retVal <- rep_len("NA", length(raw))
        # breaks = c(1879, seq(1949, 1989, 10), 2049)
        # cutVal <- cut(raw[!is.na(raw)], breaks = breaks, 
        #               labels = as.character(breaks + 1)[1:(length(breaks) - 1)])
        cutVal <- cut(raw[!is.na(raw)], breaks = c(15, 20, 25, 30, 35, 40, 50, 65, 90))
        retVal[!is.na(raw)] <- levels(cutVal)[cutVal]
        return(factor(retVal, levels = c("NA"
                ,"(15,20]","(20,25]","(25,30]","(30,35]","(35,40]","(40,50]","(50,65]","(65,90]"),
                        ordered = TRUE))
    }
    , args = c("YOB"))

# YOB.Age.fctr needs to be synced with YOB.Age.dff; Create a separate sub-function ???
glbFeatsDerive[["YOB.Age.dff"]] <- list(
    mapfn = function(raw1) {
        raw <- 2016 - raw1 
        raw[!is.na(raw) & (raw <= 15)] <- NA
        raw[!is.na(raw) & (raw >= 90)] <- NA        
        breaks <- c(15, 20, 25, 30, 35, 40, 50, 65, 90)

        # retVal <- rep_len(0, length(raw))
        stopifnot(sum(!is.na(raw) && (raw <= 15)) == 0)
        stopifnot(sum(!is.na(raw) && (raw >= 90)) == 0) 
        # msk <- !is.na(raw) && (raw > 15) && (raw <= 20); if (sum(msk > 0)) retVal[msk] <- raw[msk] - 15
        # msk <- !is.na(raw) && (raw > 20) && (raw <= 25); if (sum(msk > 0)) retVal[msk] <- raw[msk] - 20
        # msk <- !is.na(raw) && (raw > 25) && (raw <= 30); if (sum(msk > 0)) retVal[msk] <- raw[msk] - 25
        # msk <- !is.na(raw) && (raw > 30) && (raw <= 35); if (sum(msk > 0)) retVal[msk] <- raw[msk] - 30
        # msk <- !is.na(raw) && (raw > 35) && (raw <= 40); if (sum(msk > 0)) retVal[msk] <- raw[msk] - 35
        # msk <- !is.na(raw) && (raw > 40) && (raw <= 50); if (sum(msk > 0)) retVal[msk] <- raw[msk] - 40
        # msk <- !is.na(raw) && (raw > 50) && (raw <= 65); if (sum(msk > 0)) retVal[msk] <- raw[msk] - 50
        # msk <- !is.na(raw) && (raw > 65) && (raw <= 90); if (sum(msk > 0)) retVal[msk] <- raw[msk] - 65

        breaks <- c(15, 20, 25, 30, 35, 40, 50, 65, 90)        
        retVal <- sapply(raw, function(age) {
            if (is.na(age)) return(0) else
            if ((age > 15) && (age <= 20)) return(age - 15) else
            if ((age > 20) && (age <= 25)) return(age - 20) else
            if ((age > 25) && (age <= 30)) return(age - 25) else
            if ((age > 30) && (age <= 35)) return(age - 30) else
            if ((age > 35) && (age <= 40)) return(age - 35) else
            if ((age > 40) && (age <= 50)) return(age - 40) else
            if ((age > 50) && (age <= 65)) return(age - 50) else
            if ((age > 65) && (age <= 90)) return(age - 65)
        })
        
        return(retVal)
    }
    , args = c("YOB"))

glbFeatsDerive[["Gender.fctr"]] <- list(
    mapfn = function(raw1) {
        raw <- raw1
        raw[raw %in% ""] <- "N"
        raw <- gsub("Male"  , "M", raw, fixed = TRUE)
        raw <- gsub("Female", "F", raw, fixed = TRUE)        
        return(relevel(as.factor(raw), ref = "N"))
    }
    , args = c("Gender"))

glbFeatsDerive[["Income.fctr"]] <- list(
    mapfn = function(raw1) { raw <- raw1;
        raw[raw %in% ""] <- "N"
        raw <- gsub("under $25,000"      , "<25K"    , raw, fixed = TRUE)
        raw <- gsub("$25,001 - $50,000"  , "25-50K"  , raw, fixed = TRUE)
        raw <- gsub("$50,000 - $74,999"  , "50-75K"  , raw, fixed = TRUE)
        raw <- gsub("$75,000 - $100,000" , "75-100K" , raw, fixed = TRUE)        
        raw <- gsub("$100,001 - $150,000", "100-150K", raw, fixed = TRUE)
        raw <- gsub("over $150,000"      , ">150K"   , raw, fixed = TRUE)        
        return(factor(raw, levels = c("N","<25K","25-50K","50-75K","75-100K","100-150K",">150K"),
                      ordered = TRUE))
    }
    , args = c("Income"))

glbFeatsDerive[["Hhold.fctr"]] <- list(
    mapfn = function(raw1) { raw <- raw1;
        raw[raw %in% ""] <- "N"
        raw <- gsub("Domestic Partners (no kids)", "PKn", raw, fixed = TRUE)
        raw <- gsub("Domestic Partners (w/kids)" , "PKy", raw, fixed = TRUE)        
        raw <- gsub("Married (no kids)"          , "MKn", raw, fixed = TRUE)
        raw <- gsub("Married (w/kids)"           , "MKy", raw, fixed = TRUE)        
        raw <- gsub("Single (no kids)"           , "SKn", raw, fixed = TRUE)
        raw <- gsub("Single (w/kids)"            , "SKy", raw, fixed = TRUE)        
        return(relevel(as.factor(raw), ref = "N"))
    }
    , args = c("HouseholdStatus"))

glbFeatsDerive[["Edn.fctr"]] <- list(
    mapfn = function(raw1) { raw <- raw1;
        raw[raw %in% ""] <- "N"
        raw <- gsub("Current K-12"         , "K12", raw, fixed = TRUE)
        raw <- gsub("High School Diploma"  , "HSD", raw, fixed = TRUE)        
        raw <- gsub("Current Undergraduate", "CCg", raw, fixed = TRUE)
        raw <- gsub("Associate's Degree"   , "Ast", raw, fixed = TRUE)
        raw <- gsub("Bachelor's Degree"    , "Bcr", raw, fixed = TRUE)        
        raw <- gsub("Master's Degree"      , "Msr", raw, fixed = TRUE)
        raw <- gsub("Doctoral Degree"      , "PhD", raw, fixed = TRUE)        
        return(factor(raw, levels = c("N","K12","HSD","CCg","Ast","Bcr","Msr","PhD"),
                      ordered = TRUE))
    }
    , args = c("EducationLevel"))

# for (qsn in c("Q124742","Q124122"))
# for (qsn in grep("Q12(.{4})(?!\\.fctr)", names(glbObsTrn), value = TRUE, perl = TRUE))
for (qsn in grep("Q", glbFeatsExclude, fixed = TRUE, value = TRUE))    
    glbFeatsDerive[[paste0(qsn, ".fctr")]] <- list(
        mapfn = function(raw1) {
            raw1[raw1 %in% ""] <- "NA"
            rawVal <- unique(raw1)
            
            if (length(setdiff(rawVal, (expVal <- c("NA", "No", "Ys")))) == 0) {
                raw1 <- gsub("Yes", "Ys", raw1, fixed = TRUE)
                if (length(setdiff(rawVal, expVal)) > 0)
                    stop(qsn, " vals: ", paste0(rawVal, collapse = "|"), 
                         " does not match expectation: ", paste0(expVal, collapse = "|"))
            } else
            if (length(setdiff(rawVal, (expVal <- c("NA", "Me", "Circumstances")))) == 0) {
                raw1 <- gsub("Circumstances", "Cs", raw1, fixed = TRUE)
                if (length(setdiff(rawVal, expVal)) > 0)
                    stop(qsn, " vals: ", paste0(rawVal, collapse = "|"), 
                         " does not match expectation: ", paste0(expVal, collapse = "|"))
            } else
            if (length(setdiff(rawVal, (expVal <- c("NA", "Grrr people", "Yay people!")))) == 0) {
                raw1 <- gsub("Grrr people", "Gr", raw1, fixed = TRUE)
                raw1 <- gsub("Yay people!", "Yy", raw1, fixed = TRUE)                
                if (length(setdiff(rawVal, expVal)) > 0)
                    stop(qsn, " vals: ", paste0(rawVal, collapse = "|"), 
                         " does not match expectation: ", paste0(expVal, collapse = "|"))
            } else
            if (length(setdiff(rawVal, (expVal <- c("NA", "Idealist", "Pragmatist")))) == 0) {
                raw1 <- gsub("Idealist"  , "Id", raw1, fixed = TRUE)
                raw1 <- gsub("Pragmatist", "Pr", raw1, fixed = TRUE)                
                if (length(setdiff(rawVal, expVal)) > 0)
                    stop(qsn, " vals: ", paste0(rawVal, collapse = "|"), 
                         " does not match expectation: ", paste0(expVal, collapse = "|"))
            } else
            if (length(setdiff(rawVal, (expVal <- c("NA", "Private", "Public")))) == 0) {
                raw1 <- gsub("Private", "Pt", raw1, fixed = TRUE)
                raw1 <- gsub("Public" , "Pc", raw1, fixed = TRUE)                
                if (length(setdiff(rawVal, expVal)) > 0)
                    stop(qsn, " vals: ", paste0(rawVal, collapse = "|"), 
                         " does not match expectation: ", paste0(expVal, collapse = "|"))
            }
            
            return(relevel(as.factor(raw1), ref = "NA"))
        }
        , args = c(qsn))

# If imputation of missing data is not working ...
# glbFeatsDerive[["FertilityRate.nonNA"]] <- list(
#     mapfn = function(FertilityRate, Region) {
#         RegionMdn <- tapply(FertilityRate, Region, FUN = median, na.rm = TRUE)
# 
#         retVal <- FertilityRate
#         retVal[is.na(FertilityRate)] <- RegionMdn[Region[is.na(FertilityRate)]]
#         return(retVal)
#     }
#     , args = c("FertilityRate", "Region"))
    
#     mapfn = function(HOSPI.COST) { return(cut(HOSPI.COST, 5, breaks = c(0, 100000, 200000, 300000, 900000), labels = NULL)) }     
#     mapfn = function(Rasmussen)  { return(ifelse(sign(Rasmussen) >= 0, 1, 0)) } 
#     mapfn = function(startprice) { return(startprice ^ (1/2)) }       
#     mapfn = function(startprice) { return(log(startprice)) }   
#     mapfn = function(startprice) { return(exp(-startprice / 20)) }
#     mapfn = function(startprice) { return(scale(log(startprice))) }     
#     mapfn = function(startprice) { return(sign(sprice.predict.diff) * (abs(sprice.predict.diff) ^ (1/10))) }        

    # factor      
#     mapfn = function(PropR) { return(as.factor(ifelse(PropR >= 0.5, "Y", "N"))) }
#     mapfn = function(productline, description) { as.factor(gsub(" ", "", productline)) }
#     mapfn = function(purpose) { return(relevel(as.factor(purpose), ref="all_other")) }
#     mapfn = function(raw) { tfr_raw <- as.character(cut(raw, 5)); 
#                             tfr_raw[is.na(tfr_raw)] <- "NA.my";
#                             return(as.factor(tfr_raw)) }
#     mapfn = function(startprice.log10) { return(cut(startprice.log10, 3)) }
#     mapfn = function(startprice.log10) { return(cut(sprice.predict.diff, c(-1000, -100, -10, -1, 0, 1, 10, 100, 1000))) }    

#     , args = c("<arg1>"))
    
    # multiple args
#     mapfn = function(id, date) { return(paste(as.character(id), as.character(date), sep = "#")) }        
#     mapfn = function(PTS, oppPTS) { return(PTS - oppPTS) }
#     mapfn = function(startprice.log10.predict, startprice) {
#                  return(spdiff <- (10 ^ startprice.log10.predict) - startprice) } 
#     mapfn = function(productline, description) { as.factor(
#         paste(gsub(" ", "", productline), as.numeric(nchar(description) > 0), sep = "*")) }
#     mapfn = function(.src, .pos) { 
#         return(paste(.src, sprintf("%04d", 
#                                    ifelse(.src == "Train", .pos, .pos - 7049)
#                                    ), sep = "#")) }       

# # If glbObsAll is not sorted in the desired manner
#     mapfn=function(Week) { return(coredata(lag(zoo(orderBy(~Week, glbObsAll)$ILI), -2, na.pad=TRUE))) }
#     mapfn=function(ILI) { return(coredata(lag(zoo(ILI), -2, na.pad=TRUE))) }
#     mapfn=function(ILI.2.lag) { return(log(ILI.2.lag)) }

# glbFeatsDerive[["<var1>"]] <- glbFeatsDerive[["<var2>"]]

# tst <- "descr.my"; args_lst <- NULL; for (arg in glbFeatsDerive[[tst]]$args) args_lst[[arg]] <- glbObsAll[, arg]; print(head(args_lst[[arg]])); print(head(drv_vals <- do.call(glbFeatsDerive[[tst]]$mapfn, args_lst))); 
# print(which_ix <- which(args_lst[[arg]] == 0.75)); print(drv_vals[which_ix]); 

glbFeatsDateTime <- list()
# Use OlsonNames() to enumerate supported time zones
# glbFeatsDateTime[["<DateTimeFeat>"]] <- 
#     c(format = "%Y-%m-%d %H:%M:%S" or "%m/%e/%y", timezone = "US/Eastern", impute.na = TRUE, 
#       last.ctg = FALSE, poly.ctg = FALSE)

glbFeatsPrice <- NULL # or c("<price_var>")

glbFeatsImage <- list() #list(<imageFeat> = list(patchSize = 10)) # if patchSize not specified, no patch computation

glbFeatsText <- list()
Sys.setlocale("LC_ALL", "C") # For english
## [1] "C/C/C/C/C/en_US.UTF-8"
#glbFeatsText[["<TextFeature>"]] <- list(NULL,
#   ,names = myreplacePunctuation(str_to_lower(gsub(" ", "", c(NULL, 
#       <comma-separated-screened-names>
#   ))))
#   ,rareWords = myreplacePunctuation(str_to_lower(gsub(" ", "", c(NULL, 
#       <comma-separated-nonSCOWL-words>
#   ))))
#)

# Text Processing Step: custom modifications not present in txt_munge -> use glbFeatsDerive
# Text Processing Step: universal modifications
glb_txt_munge_filenames_pfx <- "<projectId>_mytxt_"

# Text Processing Step: tolower
# Text Processing Step: myreplacePunctuation
# Text Processing Step: removeWords
glb_txt_stop_words <- list()
# Remember to use unstemmed words
if (length(glbFeatsText) > 0) {
    require(tm)
    require(stringr)

    glb_txt_stop_words[["<txt_var>"]] <- sort(myreplacePunctuation(str_to_lower(gsub(" ", "", c(NULL
        # Remove any words from stopwords            
#         , setdiff(myreplacePunctuation(stopwords("english")), c("<keep_wrd1>", <keep_wrd2>"))
                                
        # Remove salutations
        ,"mr","mrs","dr","Rev"                                

        # Remove misc
        #,"th" # Happy [[:digit::]]+th birthday 

        # Remove terms present in Trn only or New only; search for "Partition post-stem"
        #   ,<comma-separated-terms>        

        # cor.y.train == NA
#         ,unlist(strsplit(paste(c(NULL
#           ,"<comma-separated-terms>"
#         ), collapse=",")

        # freq == 1; keep c("<comma-separated-terms-to-keep>")
            # ,<comma-separated-terms>

        # chisq.pval high (e.g. == 1); keep c("<comma-separated-terms-to-keep>")
            # ,<comma-separated-terms>

        # nzv.freqRatio high (e.g. >= glbFeatsNzvFreqMax); keep c("<comma-separated-terms-to-keep>")
            # ,<comma-separated-terms>        
                                            )))))
}
#orderBy(~term, glb_post_stem_words_terms_df_lst[[txtFeat]][grep("^man", glb_post_stem_words_terms_df_lst[[txtFeat]]$term), ])
#glbObsAll[glb_post_stem_words_terms_mtrx_lst[[txtFeat]][, 4866] > 0, c(glb_rsp_var, txtFeat)]

# To identify terms with a specific freq
#paste0(sort(subset(glb_post_stop_words_terms_df_lst[[txtFeat]], freq == 1)$term), collapse = ",")
#paste0(sort(subset(glb_post_stem_words_terms_df_lst[[txtFeat]], freq <= 2)$term), collapse = ",")
#subset(glb_post_stem_words_terms_df_lst[[txtFeat]], term %in% c("zinger"))

# To identify terms with a specific freq & 
#   are not stemmed together later OR is value of color.fctr (e.g. gold)
#paste0(sort(subset(glb_post_stop_words_terms_df_lst[[txtFeat]], (freq == 1) & !(term %in% c("blacked","blemish","blocked","blocks","buying","cables","careful","carefully","changed","changing","chargers","cleanly","cleared","connect","connects","connected","contains","cosmetics","default","defaulting","defective","definitely","describe","described","devices","displays","drop","drops","engravement","excellant","excellently","feels","fix","flawlessly","frame","framing","gentle","gold","guarantee","guarantees","handled","handling","having","install","iphone","iphones","keeped","keeps","known","lights","line","lining","liquid","liquidation","looking","lots","manuals","manufacture","minis","most","mostly","network","networks","noted","opening","operated","performance","performs","person","personalized","photograph","physically","placed","places","powering","pre","previously","products","protection","purchasing","returned","rotate","rotation","running","sales","second","seconds","shipped","shuts","sides","skin","skinned","sticker","storing","thats","theres","touching","unusable","update","updates","upgrade","weeks","wrapped","verified","verify") ))$term), collapse = ",")

#print(subset(glb_post_stem_words_terms_df_lst[[txtFeat]], (freq <= 2)))
#glbObsAll[which(terms_mtrx[, 229] > 0), glbFeatsText]

# To identify terms with cor.y == NA
#orderBy(~-freq+term, subset(glb_post_stop_words_terms_df_lst[[txtFeat]], is.na(cor.y)))
#paste(sort(subset(glb_post_stop_words_terms_df_lst[[txtFeat]], is.na(cor.y))[, "term"]), collapse=",")
#orderBy(~-freq+term, subset(glb_post_stem_words_terms_df_lst[[txtFeat]], is.na(cor.y)))

# To identify terms with low cor.y.abs
#head(orderBy(~cor.y.abs+freq+term, subset(glb_post_stem_words_terms_df_lst[[txtFeat]], !is.na(cor.y))), 5)

# To identify terms with high chisq.pval
#subset(glb_post_stem_words_terms_df_lst[[txtFeat]], chisq.pval > 0.99)
#paste0(sort(subset(glb_post_stem_words_terms_df_lst[[txtFeat]], (chisq.pval > 0.99) & (freq <= 10))$term), collapse=",")
#paste0(sort(subset(glb_post_stem_words_terms_df_lst[[txtFeat]], (chisq.pval > 0.9))$term), collapse=",")
#head(orderBy(~-chisq.pval+freq+term, glb_post_stem_words_terms_df_lst[[txtFeat]]), 5)
#glbObsAll[glb_post_stem_words_terms_mtrx_lst[[txtFeat]][, 68] > 0, glbFeatsText]
#orderBy(~term, glb_post_stem_words_terms_df_lst[[txtFeat]][grep("^m", glb_post_stem_words_terms_df_lst[[txtFeat]]$term), ])

# To identify terms with high nzv.freqRatio
#summary(glb_post_stem_words_terms_df_lst[[txtFeat]]$nzv.freqRatio)
#paste0(sort(setdiff(subset(glb_post_stem_words_terms_df_lst[[txtFeat]], (nzv.freqRatio >= glbFeatsNzvFreqMax) & (freq < 10) & (chisq.pval >= 0.05))$term, c( "128gb","3g","4g","gold","ipad1","ipad3","ipad4","ipadair2","ipadmini2","manufactur","spacegray","sprint","tmobil","verizon","wifion"))), collapse=",")

# To identify obs with a txt term
#tail(orderBy(~-freq+term, glb_post_stop_words_terms_df_lst[[txtFeat]]), 20)
#mydspObs(list(descr.my.contains="non"), cols=c("color", "carrier", "cellular", "storage"))
#grep("ever", dimnames(terms_stop_mtrx)$Terms)
#which(terms_stop_mtrx[, grep("ipad", dimnames(terms_stop_mtrx)$Terms)] > 0)
#glbObsAll[which(terms_stop_mtrx[, grep("16", dimnames(terms_stop_mtrx)$Terms)[1]] > 0), c(glbFeatsCategory, "storage", txtFeat)]

# Text Processing Step: screen for names # Move to glbFeatsText specs section in order of text processing steps
# glbFeatsText[["<txtFeat>"]]$names <- myreplacePunctuation(str_to_lower(gsub(" ", "", c(NULL
#         # Person names for names screening
#         ,<comma-separated-list>
#         
#         # Company names
#         ,<comma-separated-list>
#                     
#         # Product names
#         ,<comma-separated-list>
#     ))))

# glbFeatsText[["<txtFeat>"]]$rareWords <- myreplacePunctuation(str_to_lower(gsub(" ", "", c(NULL
#         # Words not in SCOWL db
#         ,<comma-separated-list>
#     ))))

# To identify char vectors post glbFeatsTextMap
#grep("six(.*)hour", glb_txt_chr_lst[[txtFeat]], ignore.case = TRUE, value = TRUE)
#grep("[S|s]ix(.*)[H|h]our", glb_txt_chr_lst[[txtFeat]], value = TRUE)

# To identify whether terms shd be synonyms
#orderBy(~term, glb_post_stop_words_terms_df_lst[[txtFeat]][grep("^moder", glb_post_stop_words_terms_df_lst[[txtFeat]]$term), ])
# term_row_df <- glb_post_stop_words_terms_df_lst[[txtFeat]][grep("^came$", glb_post_stop_words_terms_df_lst[[txtFeat]]$term), ]
# 
# cor(glb_post_stop_words_terms_mtrx_lst[[txtFeat]][glbObsAll$.lcn == "Fit", term_row_df$pos], glbObsTrn[, glb_rsp_var], use="pairwise.complete.obs")

# To identify which stopped words are "close" to a txt term
#sort(glbFeatsCluster)

# Text Processing Step: stemDocument
# To identify stemmed txt terms
#glb_post_stop_words_terms_df_lst[[txtFeat]][grep("^la$", glb_post_stop_words_terms_df_lst[[txtFeat]]$term), ]
#orderBy(~term, glb_post_stem_words_terms_df_lst[[txtFeat]][grep("^con", glb_post_stem_words_terms_df_lst[[txtFeat]]$term), ])
#glbObsAll[which(terms_stem_mtrx[, grep("use", dimnames(terms_stem_mtrx)$Terms)[[1]]] > 0), c(glbFeatsId, "productline", txtFeat)]
#glbObsAll[which(TfIdf_stem_mtrx[, 191] > 0), c(glbFeatsId, glbFeatsCategory, txtFeat)]
#glbObsAll[which(glb_post_stop_words_terms_mtrx_lst[[txtFeat]][, 6165] > 0), c(glbFeatsId, glbFeatsCategory, txtFeat)]
#which(glbObsAll$UniqueID %in% c(11915, 11926, 12198))

# Text Processing Step: mycombineSynonyms
#   To identify which terms are associated with not -> combine "could not" & "couldn't"
#findAssocs(glb_full_DTM_lst[[txtFeat]], "not", 0.05)
#   To identify which synonyms should be combined
#orderBy(~term, glb_post_stem_words_terms_df_lst[[txtFeat]][grep("^c", glb_post_stem_words_terms_df_lst[[txtFeat]]$term), ])
chk_comb_cor <- function(syn_lst) {
#     cor(terms_stem_mtrx[glbObsAll$.src == "Train", grep("^(damag|dent|ding)$", dimnames(terms_stem_mtrx)[[2]])], glbObsTrn[, glb_rsp_var], use="pairwise.complete.obs")
    print(subset(glb_post_stem_words_terms_df_lst[[txtFeat]], term %in% syn_lst$syns))
    print(subset(get_corpus_terms(tm_map(glbFeatsTextCorpus[[txtFeat]], mycombineSynonyms, list(syn_lst), lazy=FALSE)), term == syn_lst$word))
#     cor(terms_stop_mtrx[glbObsAll$.src == "Train", grep("^(damage|dent|ding)$", dimnames(terms_stop_mtrx)[[2]])], glbObsTrn[, glb_rsp_var], use="pairwise.complete.obs")
#     cor(rowSums(terms_stop_mtrx[glbObsAll$.src == "Train", grep("^(damage|dent|ding)$", dimnames(terms_stop_mtrx)[[2]])]), glbObsTrn[, glb_rsp_var], use="pairwise.complete.obs")
}
#chk_comb_cor(syn_lst=list(word="cabl",  syns=c("cabl", "cord")))
#chk_comb_cor(syn_lst=list(word="damag",  syns=c("damag", "dent", "ding")))
#chk_comb_cor(syn_lst=list(word="dent",  syns=c("dent", "ding")))
#chk_comb_cor(syn_lst=list(word="use",  syns=c("use", "usag")))

glbFeatsTextSynonyms <- list()
# list parsed to collect glbFeatsText[[<txtFeat>]]$vldTerms
# glbFeatsTextSynonyms[["Hdln.my"]] <- list(NULL
#     # people in places
#     , list(word = "australia", syns = c("australia", "australian"))
#     , list(word = "italy", syns = c("italy", "Italian"))
#     , list(word = "newyork", syns = c("newyork", "newyorker"))    
#     , list(word = "Pakistan", syns = c("Pakistan", "Pakistani"))    
#     , list(word = "peru", syns = c("peru", "peruvian"))
#     , list(word = "qatar", syns = c("qatar", "qatari"))
#     , list(word = "scotland", syns = c("scotland", "scotish"))
#     , list(word = "Shanghai", syns = c("Shanghai", "Shanzhai"))    
#     , list(word = "venezuela", syns = c("venezuela", "venezuelan"))    
# 
#     # companies - needs to be data dependent 
#     #   - e.g. ensure BNP in this experiment/feat always refers to BNPParibas
#         
#     # general synonyms
#     , list(word = "Create", syns = c("Create","Creator")) 
#     , list(word = "cute", syns = c("cute","cutest"))     
#     , list(word = "Disappear", syns = c("Disappear","Fadeout"))     
#     , list(word = "teach", syns = c("teach", "taught"))     
#     , list(word = "theater",  syns = c("theater", "theatre", "theatres")) 
#     , list(word = "understand",  syns = c("understand", "understood"))    
#     , list(word = "weak",  syns = c("weak", "weaken", "weaker", "weakest"))
#     , list(word = "wealth",  syns = c("wealth", "wealthi"))    
#     
#     # custom synonyms (phrases)
#     
#     # custom synonyms (names)
#                                       )
#glbFeatsTextSynonyms[["<txtFeat>"]] <- list(NULL
#     , list(word="<stem1>",  syns=c("<stem1>", "<stem1_2>"))
#                                       )

for (txtFeat in names(glbFeatsTextSynonyms))
    for (entryIx in 1:length(glbFeatsTextSynonyms[[txtFeat]])) {
        glbFeatsTextSynonyms[[txtFeat]][[entryIx]]$word <-
            str_to_lower(glbFeatsTextSynonyms[[txtFeat]][[entryIx]]$word)
        glbFeatsTextSynonyms[[txtFeat]][[entryIx]]$syns <-
            str_to_lower(glbFeatsTextSynonyms[[txtFeat]][[entryIx]]$syns)        
    }        

glbFeatsTextSeed <- 181
# tm options include: check tm::weightSMART 
glb_txt_terms_control <- list( # Gather model performance & run-time stats
                    # weighting = function(x) weightSMART(x, spec = "nnn")
                    # weighting = function(x) weightSMART(x, spec = "lnn")
                    # weighting = function(x) weightSMART(x, spec = "ann")
                    # weighting = function(x) weightSMART(x, spec = "bnn")
                    # weighting = function(x) weightSMART(x, spec = "Lnn")
                    # 
                    weighting = function(x) weightSMART(x, spec = "ltn") # default
                    # weighting = function(x) weightSMART(x, spec = "lpn")                    
                    # 
                    # weighting = function(x) weightSMART(x, spec = "ltc")                    
                    # 
                    # weighting = weightBin 
                    # weighting = weightTf 
                    # weighting = weightTfIdf # : default
                # termFreq selection criteria across obs: tm default: list(global=c(1, Inf))
                    , bounds = list(global = c(1, Inf)) 
                # wordLengths selection criteria: tm default: c(3, Inf)
                    , wordLengths = c(1, Inf) 
                              ) 

glb_txt_cor_var <- glb_rsp_var # : default # or c(<feat>)

# select one from c("union.top.val.cor", "top.cor", "top.val", default: "top.chisq", "sparse")
glbFeatsTextFilter <- "top.chisq" 
glbFeatsTextTermsMax <- rep(10, length(glbFeatsText)) # :default
names(glbFeatsTextTermsMax) <- names(glbFeatsText)

# Text Processing Step: extractAssoc
glbFeatsTextAssocCor <- rep(1, length(glbFeatsText)) # :default 
names(glbFeatsTextAssocCor) <- names(glbFeatsText)

# Remember to use stemmed terms
glb_important_terms <- list()

# Text Processing Step: extractPatterns (ngrams)
glbFeatsTextPatterns <- list()
#glbFeatsTextPatterns[[<txtFeat>>]] <- list()
#glbFeatsTextPatterns[[<txtFeat>>]] <- c(metropolitan.diary.colon = "Metropolitan Diary:")

# Have to set it even if it is not used
# Properties:
#   numrows(glb_feats_df) << numrows(glbObsFit
#   Select terms that appear in at least 0.2 * O(FP/FN(glbObsOOB)) ???
#       numrows(glbObsOOB) = 1.1 * numrows(glbObsNew) ???
glb_sprs_thresholds <- NULL # or c(<txtFeat1> = 0.988, <txtFeat2> = 0.970, <txtFeat3> = 0.970)

glbFctrMaxUniqVals <- 20 # default: 20
glb_impute_na_data <- FALSE # or TRUE
glb_mice_complete.seed <- 144 # or any integer

glbFeatsCluster <- paste(grep("^Q.", glbFeatsExclude, value = TRUE), "fctr", sep = ".") # NULL : glbFeatsCluster <- c("YOB.Age.fctr", "Gender.fctr", "Income.fctr", 
                     # # "Hhold.fctr",
                     # "Edn.fctr",
                     # paste(grep("^Q.", glbFeatsExclude, value = TRUE), "fctr", sep = ".")) # NULL : default or c("<feat1>", "<feat2>")
# glbFeatsCluster <- grep(paste0("[", 
#                         toupper(paste0(substr(glbFeatsText, 1, 1), collapse = "")),
#                                       "]\\.[PT]\\."), 
#                                names(glbObsAll), value = TRUE)

glb_cluster.seed <- 189 # or any integer
glbClusterEntropyVar <- NULL # c(glb_rsp_var, as.factor(cut(glb_rsp_var, 3)), default: NULL)
glbFeatsClusterVarsExclude <- FALSE # default FALSE

glb_interaction_only_feats <- NULL # : default or c(<parent_feat> = "<child_feat>")

glbFeatsNzvFreqMax <- 19 # 19 : caret default
glbFeatsNzvUniqMin <- 10 # 10 : caret default

glbRFESizes <- list()
#glbRFESizes[["mdlFamily"]] <- c(4, 8, 16, 32, 64, 67, 68, 69) # Accuracy@69/70 = 0.8258
# glbRFESizes[["RFE.X"]] <- c(96, 112, 120, 124, 128, 129, 130, 131, 132, 133, 135, 138, 142, 157, 187, 247) # accuracy(131) = 0.6285
# glbRFESizes[["Final"]] <- c(8, 16, 32, 40, 44, 46, 48, 49, 50, 51, 52, 56, 64, 96, 128, 247) # accuracy(49) = 0.6164

glbRFEResults <- NULL

glbObsFitOutliers <- list()
# If outliers.n >= 10; consider concatenation of interaction vars
# glbObsFitOutliers[["<mdlFamily>"]] <- c(NULL
#     is.na(.rstudent)
#     max(.rstudent)
#     is.na(.dffits)
#     .hatvalues >= 0.99        
#     -38,167,642 < minmax(.rstudent) < 49,649,823    
#     , <comma-separated-<glbFeatsId>>
#                                     )
glbObsTrnOutliers <- list()
glbObsTrnOutliers[["Final"]] <- union(glbObsFitOutliers[["All.X"]],
                                c(NULL
                                ))

# Modify mdlId to (build & extract) "<FamilyId>#<Fit|Trn>#<caretMethod>#<preProc1.preProc2>#<samplingMethod>"
glb_models_lst <- list(); glb_models_df <- data.frame()

# Add xgboost algorithm

# Regression
if (glb_is_regression) {
    glbMdlMethods <- c(NULL
        # deterministic
            #, "lm", # same as glm
            , "glm", "bayesglm", "glmnet"
            , "rpart"
        # non-deterministic
            , "gbm", "rf" 
        # Unknown
            , "nnet" , "avNNet" # runs 25 models per cv sample for tunelength=5
            , "svmLinear", "svmLinear2"
            , "svmPoly" # runs 75 models per cv sample for tunelength=5
            , "svmRadial" 
            , "earth"
            , "bagEarth" # Takes a long time
            ,"xgbLinear","xgbTree"
        )
} else
# Classification - Add ada (auto feature selection)
    if (glb_is_binomial)
        glbMdlMethods <- c(NULL
        # deterministic                     
            , "bagEarth" # Takes a long time        
            , "glm", "bayesglm", "glmnet"
            , "nnet"
            , "rpart"
        # non-deterministic        
            , "gbm"
            , "avNNet" # runs 25 models per cv sample for tunelength=5      
            , "rf"
        # Unknown
            , "lda", "lda2"
                # svm models crash when predict is called -> internal to kernlab it should call predict without .outcome
            , "svmLinear", "svmLinear2"
            , "svmPoly" # runs 75 models per cv sample for tunelength=5
            , "svmRadial" 
            , "earth"
            ,"xgbLinear","xgbTree"
        ) else
        glbMdlMethods <- c(NULL
        # deterministic
            ,"glmnet"
        # non-deterministic 
            ,"rf"       
        # Unknown
            ,"gbm","rpart","xgbLinear","xgbTree"
        )

glbMdlFamilies <- list(); glb_mdl_feats_lst <- list()
# family: Choose from c("RFE.X", "Csm.X", "All.X", "Best.Interact") %*% c(NUll, ".NOr", ".Inc")
#   RFE = "Recursive Feature Elimination"
#   Csm = CuStoM
#   NOr = No OutlieRs
#   Inc = INteraCt
#   methods: Choose from c(NULL, <method>, glbMdlMethods) 
#glbMdlFamilies[["RFE.X"]] <- c("glmnet", "glm") # non-NULL vector is mandatory
if (glb_is_classification && !glb_is_binomial) {
    # glm does not work for multinomial
    glbMdlFamilies[["All.X"]] <- c("glmnet") 
} else {
    # glbMdlFamilies[["All.X"]] <- c("glmnet", "glm")
    glbMdlFamilies[["All.X"]] <- c("glmnet")    
    # glbMdlFamilies[["RFE.X"]] <- c("glmnet", "glm")
    # glbMdlFamilies[["RFE.X"]] <- setdiff(glbMdlMethods, c(NULL
    #     , "bayesglm" # error: Error in trControl$classProbs && any(classLevels != make.names(classLevels)) : invalid 'x' type in 'x && y'
    #     , "lda","lda2" # error: Error in lda.default(x, grouping, ...) : variable 236 appears to be constant within groups
    #     , "svmLinear" # Error in .local(object, ...) : test vector does not match model ! In addition: Warning messages:
    #     , "svmLinear2" # SVM has not been trained using `probability = TRUE`, probabilities not available for predictions
    #     , "svmPoly" # runs 75 models per cv sample for tunelength=5 # took > 2 hrs # Error in .local(object, ...) : test vector does not match model !     
    #     , "svmRadial" # didn't bother
    #     ,"xgbLinear","xgbTree" # Need clang-omp compiler; Upgrade to Revolution R 3.2.3 (3.2.2 current); https://github.com/dmlc/xgboost/issues/276 thread
    #                                     ))
}
# glbMdlFamilies[["All.X.Inc"]] <- glbMdlFamilies[["All.X"]] # value not used
# glbMdlFamilies[["RFE.X.Inc"]] <- glbMdlFamilies[["RFE.X"]] # value not used

# Check if interaction features make RFE better
# glbMdlFamilies[["CSM.X"]] <- setdiff(glbMdlMethods, c("lda", "lda2")) # crashing due to category:.clusterid ??? #c("glmnet", "glm") # non-NULL list is mandatory
# glb_mdl_feats_lst[["CSM.X"]] <- c(NULL
#     , <comma-separated-features-vector>
#                                   )
# dAFeats.CSM.X %<d-% c(NULL
#     # Interaction feats up to varImp(RFE.X.glmnet) >= 50
#     , <comma-separated-features-vector>
#     , setdiff(myextract_actual_feats(predictors(glbRFEResults)), c(NULL
#                , <comma-separated-features-vector>
#                                                                       ))    
#                                   )
# glb_mdl_feats_lst[["CSM.X"]] <- "%<d-% dAFeats.CSM.X"

# glbMdlFamilies[["Final"]] <- c(NULL) # NULL vector acceptable # c("glmnet", "glm")

glbMdlAllowParallel <- list()
#glbMdlAllowParallel[["Final##rcv#glmnet"]] <- FALSE
glbMdlAllowParallel[["All.X##rcv#glm"]] <- FALSE
glbMdlAllowParallel[["All.X#ica#rcv#glmnet"]] <- FALSE
glbMdlAllowParallel[["All.X#zv.pca#rcv#glmnet"]] <- FALSE
glbMdlAllowParallel[["All.X#zv.pca.spatialSign#rcv#glmnet"]] <- FALSE

glbMdlAllowParallel[["Final.All.X#zv.pca#rcv#glmnet"]] <- FALSE

# Check if tuning parameters make fit better; make it mdlFamily customizable ?
glbMdlTuneParams <- data.frame()
# When glmnet crashes at model$grid with error: ???
AllX__rcv_glmnetTuneParams <- rbind(data.frame()
    ,data.frame(parameter = "alpha",  vals = "0.100 0.325 0.550 0.775 1.000")
    ,data.frame(parameter = "lambda", vals = "0.05 0.06367626 0.07 0.08 0.09167068")
                        )
AllX_zvpca_rcv_glmnetTuneParams <- rbind(data.frame()
    ,data.frame(parameter = "alpha",  vals = "0.100 0.325 0.550 0.775 1.000")
    ,data.frame(parameter = "lambda", vals = "0.0055615497 0.01 0.0258144271 0.03 0.0460673")
                        ) # max.Accuracy.OOB = 0.6020202 @ 0.55 0.03
# AllX_expoTransspatialSign_rcv_glmnetTuneParams <- rbind(data.frame()
#     ,data.frame(parameter = "alpha",  vals = "0.100 0.325 0.550 0.775 1.000")
#     ,data.frame(parameter = "lambda", vals = "0.0072065998 0.02 0.0334500732 0.04 0.05969355")
#                         ) # max.Accuracy.OOB = 0.5956175 @ 0.325 0.03345007
# FinalAllX__rcv_glmnetTuneParams <- rbind(data.frame()
#     ,data.frame(parameter = "alpha",  vals = "0.100 0.325 0.550 0.775 1.000")
#     ,data.frame(parameter = "lambda", vals = "6.451187e-03 0.02 2.994376e-02 0.04 0.05343633")
#                         )
# FinalAllX_expoTransspatialSign_rcv_glmnetTuneParams <- rbind(data.frame()
#     ,data.frame(parameter = "alpha",  vals = "0.100 0.325 0.550 0.775 1.000")
#     ,data.frame(parameter = "lambda", vals = "6.487621e-03 0.02 3.011287e-02 0.04 0.05373812")
#                         ) # max.Accuracy.fit = 0.5991618 @ 0.55 0.03011287
glbMdlTuneParams <- rbind(glbMdlTuneParams
    ,cbind(data.frame(mdlId = "All.X##rcv#glmnet"),            AllX__rcv_glmnetTuneParams)
    ,cbind(data.frame(mdlId = "All.X#zv.pca#rcv#glmnet"),
                                AllX_zvpca_rcv_glmnetTuneParams)
    # ,cbind(data.frame(mdlId = "All.X#expoTrans.spatialSign#rcv#glmnet")
    #                             AllX_expoTransspatialSign_rcv_glmnetTuneParams)
    # ,cbind(data.frame(mdlId = "Final.All.X##rcv#glmnet"), FinalAllX__rcv_glmnetTuneParams)
    # ,cbind(data.frame(mdlId = "Final.All.X#expoTrans.spatialSign#rcv#glmnet")
    #                             FinalAllX_expoTransspatialSign_rcv_glmnetTuneParams)
)

    #avNNet    
    #   size=[1] 3 5 7 9; decay=[0] 1e-04 0.001  0.01   0.1; bag=[FALSE]; RMSE=1.3300906 

    #bagEarth
    #   degree=1 [2] 3; nprune=64 128 256 512 [1024]; RMSE=0.6486663 (up)
bagEarthTuneParams <- rbind(data.frame()
                        ,data.frame(parameter = "degree", vals = "1")
                        ,data.frame(parameter = "nprune", vals = "256")
                        )
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams,
#                                cbind(data.frame(mdlId = "Final.RFE.X.Inc##rcv#bagEarth"),
#                                      bagEarthTuneParams))

# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams, rbind(data.frame()
#     ,data.frame(method = "bagEarth", parameter = "nprune", vals = "256")
#     ,data.frame(method = "bagEarth", parameter = "degree", vals = "2")    
# ))

    #earth 
    #   degree=[1]; nprune=2  [9] 17 25 33; RMSE=0.1334478
    
    #gbm 
    #   shrinkage=0.05 [0.10] 0.15 0.20 0.25; n.trees=100 150 200 [250] 300; interaction.depth=[1] 2 3 4 5; n.minobsinnode=[10]; RMSE=0.2008313     
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams, rbind(data.frame()
#     ,data.frame(method = "gbm", parameter = "shrinkage", min = 0.05, max = 0.25, by = 0.05)
#     ,data.frame(method = "gbm", parameter = "n.trees", min = 100, max = 300, by = 50)
#     ,data.frame(method = "gbm", parameter = "interaction.depth", min = 1, max = 5, by = 1)
#     ,data.frame(method = "gbm", parameter = "n.minobsinnode", min = 10, max = 10, by = 10)
#     #seq(from=0.05,  to=0.25, by=0.05)
# ))

    #glmnet
    #   alpha=0.100 [0.325] 0.550 0.775 1.000; lambda=0.0005232693 0.0024288010 0.0112734954 [0.0523269304] 0.2428800957; RMSE=0.6164891
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams, rbind(data.frame()
#     ,data.frame(method = "glmnet", parameter = "alpha", vals = "0.550 0.775 0.8875 0.94375 1.000")
#     ,data.frame(method = "glmnet", parameter = "lambda", vals = "9.858855e-05 0.0001971771 0.0009152152 0.0042480525 0.0197177130")    
# ))

    #nnet    
    #   size=3 5 [7] 9 11; decay=0.0001 0.001 0.01 [0.1] 0.2; RMSE=0.9287422
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams, rbind(data.frame()
#     ,data.frame(method = "nnet", parameter = "size", vals = "3 5 7 9 11")
#     ,data.frame(method = "nnet", parameter = "decay", vals = "0.0001 0.0010 0.0100 0.1000 0.2000")    
# ))

    #rf # Don't bother; results are not deterministic
    #       mtry=2  35  68 [101] 134; RMSE=0.1339974
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams, rbind(data.frame()
#     ,data.frame(method = "rf", parameter = "mtry", vals = "2 5 9 13 17")
# ))

    #rpart 
    #   cp=0.020 [0.025] 0.030 0.035 0.040; RMSE=0.1770237
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams, rbind(data.frame()    
#     ,data.frame(method = "rpart", parameter = "cp", vals = "0.004347826 0.008695652 0.017391304 0.021739130 0.034782609")
# ))
    
    #svmLinear
    #   C=0.01 0.05 [0.10] 0.50 1.00 2.00 3.00 4.00; RMSE=0.1271318; 0.1296718
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams, rbind(data.frame()
#     ,data.frame(method = "svmLinear", parameter = "C", vals = "0.01 0.05 0.1 0.5 1")
# ))

    #svmLinear2    
    #   cost=0.0625 0.1250 [0.25] 0.50 1.00; RMSE=0.1276354 
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams, rbind(data.frame()
#     ,data.frame(method = "svmLinear2", parameter = "cost", vals = "0.0625 0.125 0.25 0.5 1")
# ))

    #svmPoly    
    #   degree=[1] 2 3 4 5; scale=0.01 0.05 [0.1] 0.5 1; C=0.50 1.00 [2.00] 3.00 4.00; RMSE=0.1276130
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams, rbind(data.frame()
#     ,data.frame(method="svmPoly", parameter="degree", min=1, max=5, by=1) #seq(1, 5, 1)
#     ,data.frame(method="svmPoly", parameter="scale", vals="0.01, 0.05, 0.1, 0.5, 1")
#     ,data.frame(method="svmPoly", parameter="C", vals="0.50, 1.00, 2.00, 3.00, 4.00")    
# ))

    #svmRadial
    #   sigma=[0.08674323]; C=0.25 0.50 1.00 [2.00] 4.00; RMSE=0.1614957
    
#glb2Sav(); all.equal(sav_models_df, glb_models_df)

pkgPreprocMethods <-     
# caret version: 6.0.068 # packageVersion("caret")
# operations are applied in this order: zero-variance filter, near-zero variance filter, Box-Cox/Yeo-Johnson/exponential transformation, centering, scaling, range, imputation, PCA, ICA then spatial sign
# *Impute methods needed only if NAs are fed to myfit_mdl
#   Also, ordered.factor in caret creates features as Edn.fctr^4 which is treated as an exponent by bagImpute
    c(NULL
      ,"zv", "nzv"
      ,"BoxCox", "YeoJohnson", "expoTrans"
      ,"center", "scale", "center.scale", "range"
      ,"knnImpute", "bagImpute", "medianImpute"
      ,"zv.pca", "ica", "spatialSign"
      ,"conditionalX") 

glbMdlPreprocMethods <- list(# NULL # : default
    "All.X" = list("glmnet" = union(setdiff(pkgPreprocMethods,
                                            c("knnImpute", "bagImpute", "medianImpute")),
                                    # c(NULL)))
                                    c("zv.pca.spatialSign")))
)
# glbMdlPreprocMethods[["RFE.X"]] <- list("glmnet" = union(unlist(glbMdlPreprocMethods[["All.X"]]),
#                                                     "nzv.pca.spatialSign"))

# Baseline prediction model feature(s)
glb_Baseline_mdl_var <- NULL # or c("<feat>")

glbMdlMetric_terms <- NULL # or matrix(c(
#                               0,1,2,3,4,
#                               2,0,1,2,3,
#                               4,2,0,1,2,
#                               6,4,2,0,1,
#                               8,6,4,2,0
#                           ), byrow=TRUE, nrow=5)
glbMdlMetricSummary <- NULL # or "<metric_name>"
glbMdlMetricMaximize <- NULL # or FALSE (TRUE is not the default for both classification & regression) 
glbMdlMetricSummaryFn <- NULL # or function(data, lev=NULL, model=NULL) {
#     confusion_mtrx <- t(as.matrix(confusionMatrix(data$pred, data$obs)))
#     #print(confusion_mtrx)
#     #print(confusion_mtrx * glbMdlMetric_terms)
#     metric <- sum(confusion_mtrx * glbMdlMetric_terms) / nrow(data)
#     names(metric) <- glbMdlMetricSummary
#     return(metric)
# }

glbMdlCheckRcv <- FALSE # Turn it on when needed; otherwise takes long time
glb_rcv_n_folds <- 3 # or NULL
glb_rcv_n_repeats <- 3 # or NULL

glb_clf_proba_threshold <- NULL # 0.5

# Model selection criteria
if (glb_is_regression)
    glbMdlMetricsEval <- c("min.RMSE.OOB", "max.R.sq.OOB", "min.elapsedtime.everything",
                           "max.Adj.R.sq.fit", "min.RMSE.fit")
    #glbMdlMetricsEval <- c("min.RMSE.fit", "max.R.sq.fit", "max.Adj.R.sq.fit")    
if (glb_is_classification) {
    if (glb_is_binomial)
        glbMdlMetricsEval <- 
            c("max.Accuracy.OOB", "max.AUCROCR.OOB", "max.AUCpROC.OOB",
              "min.elapsedtime.everything", 
              # "min.aic.fit", 
              "max.Accuracy.fit") else        
        glbMdlMetricsEval <- c("max.Accuracy.OOB", "max.Kappa.OOB", "min.elapsedtime.everything")
}

# select from NULL [no ensemble models], "auto" [all models better than MFO or Baseline], c(mdl_ids in glb_models_lst) [Typically top-rated models in auto]
glbMdlEnsemble <- NULL #"auto"
#     "%<d-% setdiff(mygetEnsembleAutoMdlIds(), 'CSM.X.rf')" 
#     c(<comma-separated-mdlIds>
#      )

# Only for classifications; for regressions remove "(.*)\\.prob" form the regex
# tmp_fitobs_df <- glbObsFit[, grep(paste0("^", gsub(".", "\\.", mygetPredictIds$value, fixed = TRUE), "CSM\\.X\\.(.*)\\.prob"), names(glbObsFit), value = TRUE)]; cor_mtrx <- cor(tmp_fitobs_df); cor_vctr <- sort(cor_mtrx[row.names(orderBy(~-Overall, varImp(glb_models_lst[["Ensemble.repeatedcv.glmnet"]])$imp))[1], ]); summary(cor_vctr); cor_vctr
#ntv.glm <- glm(reformulate(indepVar, glb_rsp_var), family = "binomial", data = glbObsFit)
#step.glm <- step(ntv.glm)

glbMdlSelId <- NULL #select from c(NULL, "All.X##rcv#glmnet", "RFE.X##rcv#glmnet", <mdlId>)
glbMdlFinId <- NULL #select from c(NULL, glbMdlSelId)

glb_dsp_cols <- c(".pos", glbFeatsId, glbFeatsCategory, glb_rsp_var
#               List critical cols excl. above
                  )

# Output specs
# lclgetfltout_df <- function(obsOutFinDf) {
#     require(tidyr)
#     obsOutFinDf <- obsOutFinDf %>%
#         tidyr::separate("ImageId.x.y", c(".src", ".pos", "x", "y"), 
#                         sep = "#", remove = TRUE, extra = "merge")
#     # mnm prefix stands for max_n_mean
#     mnmout_df <- obsOutFinDf %>%
#         dplyr::group_by(.pos) %>%
#         #dplyr::top_n(1, Probability1) %>% # Score = 3.9426         
#         #dplyr::top_n(2, Probability1) %>% # Score = ???; weighted = 3.94254;         
#         #dplyr::top_n(3, Probability1) %>% # Score = 3.9418; weighted = 3.94169; 
#         dplyr::top_n(4, Probability1) %>% # Score = ???; weighted = 3.94149;        
#         #dplyr::top_n(5, Probability1) %>% # Score = 3.9421; weighted = 3.94178
#     
#         # dplyr::summarize(xMeanN = mean(as.numeric(x)), yMeanN = mean(as.numeric(y)))
#         # dplyr::summarize(xMeanN = weighted.mean(as.numeric(x), Probability1), yMeanN = mean(as.numeric(y)))
#         # dplyr::summarize(xMeanN = weighted.mean(as.numeric(x), c(Probability1, 0.2357323, 0.2336925)), yMeanN = mean(as.numeric(y)))    
#         # dplyr::summarize(xMeanN = weighted.mean(as.numeric(x), c(Probability1)), yMeanN = mean(as.numeric(y)))
#         dplyr::summarize(xMeanN = weighted.mean(as.numeric(x), c(Probability1)), 
#                          yMeanN = weighted.mean(as.numeric(y), c(Probability1)))  
#     
#     maxout_df <- obsOutFinDf %>%
#         dplyr::group_by(.pos) %>%
#         dplyr::summarize(maxProb1 = max(Probability1))
#     fltout_df <- merge(maxout_df, obsOutFinDf, 
#                        by.x = c(".pos", "maxProb1"), by.y = c(".pos", "Probability1"),
#                        all.x = TRUE)
#     fmnout_df <- merge(fltout_df, mnmout_df, 
#                        by.x = c(".pos"), by.y = c(".pos"),
#                        all.x = TRUE)
#     return(fmnout_df)
# }
glbObsOut <- list(NULL
        # glbFeatsId will be the first output column, by default
        ,vars = list()
#         ,mapFn = function(obsOutFinDf) {
#                   }
                  )
#obsOutFinDf <- savobsOutFinDf
# glbObsOut$mapFn <- function(obsOutFinDf) {
#     txfout_df <- dplyr::select(obsOutFinDf, -.pos.y) %>%
#         dplyr::mutate(
#             lunch     = levels(glbObsTrn[, "lunch"    ])[
#                        round(mean(as.numeric(glbObsTrn[, "lunch"    ])), 0)],
#             dinner    = levels(glbObsTrn[, "dinner"   ])[
#                        round(mean(as.numeric(glbObsTrn[, "dinner"   ])), 0)],
#             reserve   = levels(glbObsTrn[, "reserve"  ])[
#                        round(mean(as.numeric(glbObsTrn[, "reserve"  ])), 0)],
#             outdoor   = levels(glbObsTrn[, "outdoor"  ])[
#                        round(mean(as.numeric(glbObsTrn[, "outdoor"  ])), 0)],
#             expensive = levels(glbObsTrn[, "expensive"])[
#                        round(mean(as.numeric(glbObsTrn[, "expensive"])), 0)],
#             liquor    = levels(glbObsTrn[, "liquor"   ])[
#                        round(mean(as.numeric(glbObsTrn[, "liquor"   ])), 0)],
#             table     = levels(glbObsTrn[, "table"    ])[
#                        round(mean(as.numeric(glbObsTrn[, "table"    ])), 0)],
#             classy    = levels(glbObsTrn[, "classy"   ])[
#                        round(mean(as.numeric(glbObsTrn[, "classy"   ])), 0)],
#             kids      = levels(glbObsTrn[, "kids"     ])[
#                        round(mean(as.numeric(glbObsTrn[, "kids"     ])), 0)]
#                       )
#     
#     print("ObsNew output class tables:")
#     print(sapply(c("lunch","dinner","reserve","outdoor",
#                    "expensive","liquor","table",
#                    "classy","kids"), 
#                  function(feat) table(txfout_df[, feat], useNA = "ifany")))
#     
#     txfout_df <- txfout_df %>%
#         dplyr::mutate(labels = "") %>%
#         dplyr::mutate(labels = 
#     ifelse(lunch     != "-1", paste(labels, lunch    ), labels)) %>%
#         dplyr::mutate(labels = 
#     ifelse(dinner    != "-1", paste(labels, dinner   ), labels)) %>%
#         dplyr::mutate(labels = 
#     ifelse(reserve   != "-1", paste(labels, reserve  ), labels)) %>%
#         dplyr::mutate(labels = 
#     ifelse(outdoor   != "-1", paste(labels, outdoor  ), labels)) %>%
#         dplyr::mutate(labels =         
#     ifelse(expensive != "-1", paste(labels, expensive), labels)) %>%
#         dplyr::mutate(labels =         
#     ifelse(liquor    != "-1", paste(labels, liquor   ), labels)) %>%
#         dplyr::mutate(labels =         
#     ifelse(table     != "-1", paste(labels, table    ), labels)) %>%
#         dplyr::mutate(labels =         
#     ifelse(classy    != "-1", paste(labels, classy   ), labels)) %>%
#         dplyr::mutate(labels =         
#     ifelse(kids      != "-1", paste(labels, kids     ), labels)) %>%
#         dplyr::select(business_id, labels)
#     return(txfout_df)
# }
#if (!is.null(glbObsOut$mapFn)) obsOutFinDf <- glbObsOut$mapFn(obsOutFinDf); print(head(obsOutFinDf))

glb_out_obs <- NULL # select from c(NULL : default to "new", "all", "new", "trn")

if (glb_is_classification && glb_is_binomial) {
    # glbObsOut$vars[["Probability1"]] <- 
    #     "%<d-% glbObsNew[, mygetPredictIds(glb_rsp_var, glbMdlFinId)$prob]" 
    # glbObsOut$vars[[glb_rsp_var_raw]] <-
    #     "%<d-% glb_map_rsp_var_to_raw(glbObsNew[,
    #                                         mygetPredictIds(glb_rsp_var, glbMdlFinId)$value])"
    glbObsOut$vars[["Predictions"]] <-
        "%<d-% glb_map_rsp_var_to_raw(glbObsNew[,
                                            mygetPredictIds(glb_rsp_var, glbMdlFinId)$value])"
} else {
#     glbObsOut$vars[[glbFeatsId]] <- 
#         "%<d-% as.integer(gsub('Test#', '', glbObsNew[, glbFeatsId]))"
    glbObsOut$vars[[glb_rsp_var]] <- 
        "%<d-% glbObsNew[, mygetPredictIds(glb_rsp_var, glbMdlFinId)$value]"
#     for (outVar in setdiff(glbFeatsExcludeLcl, glb_rsp_var_raw))
#         glbObsOut$vars[[outVar]] <- 
#             paste0("%<d-% mean(glbObsAll[, \"", outVar, "\"], na.rm = TRUE)")
}    
# glbObsOut$vars[[glb_rsp_var_raw]] <- glb_rsp_var_raw
# glbObsOut$vars[[paste0(head(unlist(strsplit(mygetPredictIds$value, "")), -1), collapse = "")]] <-

glbOutStackFnames <- # NULL #: default
    c("Votes_Ensemble_cnk06_out_fin.csv") # manual stack
    # c("ebayipads_finmdl_bid1_out_nnet_1.csv") # universal stack

glbOut <- list(pfx = "Q109244No_AllXpreProc_cnk03_fit.models_3_")
# lclImageSampleSeed <- 129
glbOutDataVizFname <- NULL # choose from c(NULL, "<projectId>_obsall.csv")


glbChunks <- list(labels = c("set_global_options_wd","set_global_options"
    ,"import.data","inspect.data","scrub.data","transform.data"
    ,"extract.features"
        ,"extract.features.datetime","extract.features.image","extract.features.price"
        ,"extract.features.text","extract.features.string"  
        ,"extract.features.end"
    ,"manage.missing.data","cluster.data","partition.data.training","select.features"
    ,"fit.models_0","fit.models_1","fit.models_2","fit.models_3"
    ,"fit.data.training_0","fit.data.training_1"
    ,"predict.data.new"         
    ,"display.session.info"))
# To ensure that all chunks in this script are in glbChunks
if (!is.null(chkChunksLabels <- knitr::all_labels()) && # knitr::all_labels() doesn't work in console runs
    !identical(chkChunksLabels, glbChunks$labels)) {
    print(sprintf("setdiff(chkChunksLabels, glbChunks$labels): %s", 
                  setdiff(chkChunksLabels, glbChunks$labels)))    
    print(sprintf("setdiff(glbChunks$labels, chkChunksLabels): %s", 
                  setdiff(glbChunks$labels, chkChunksLabels)))    
}

glbChunks[["first"]] <- "fit.models_1" # NULL # default: script will load envir from previous chunk
glbChunks[["last" ]] <- "fit.models_3" # NULL # default: script will save envir at end of this chunk 
glbChunks[["inpFilePathName"]] <- "data/Q109244No_AllXpreProc_cnk03_fit.models_0.data_fit.models_0.RData" # NULL: default or "data/<prvScriptName>_<lstChunkLbl>.RData"
#mysavChunk(glbOut$pfx, glbChunks[["last"]]) # called from myevlChunk
# Temporary: Delete this function (if any) from here after appropriate .RData file is saved

# Inspect max OOB FP
#chkObsOOB <- subset(glbObsOOB, !label.fctr.All.X..rcv.glmnet.is.acc)
#chkObsOOBFP <- subset(chkObsOOB, label.fctr.All.X..rcv.glmnet == "left_eye_center") %>% dplyr::mutate(Probability1 = label.fctr.All.X..rcv.glmnet.prob) %>% select(-.src, -.pos, -x, -y) %>% lclgetfltout_df() %>% mutate(obj.distance = (((as.numeric(x) - left_eye_center_x.int) ^ 2) + ((as.numeric(y) - left_eye_center_y.int) ^ 2)) ^ 0.5) %>% dplyr::top_n(5, obj.distance) %>% dplyr::top_n(5, -patch.cor)
#
#newImgObs <- glbObsNew[(glbObsNew$ImageId == "Test#0001"), ]; print(newImgObs[which.max(newImgObs$label.fctr.Final..rcv.glmnet.prob), ])
#OOBImgObs <- glbObsOOB[(glbObsOOB$ImageId == "Train#0003"), ]; print(OOBImgObs[which.max(OOBImgObs$label.fctr.All.X..rcv.glmnet.prob), ])

#mygetImage(which(glbObsAll[, glbFeatsId] == "Train#0003"), names(glbFeatsImage)[1], plot = TRUE, featHighlight = c("left_eye_center_x", "left_eye_center_y"), ovrlHighlight = c(66, 35))

# Depict process
glb_analytics_pn <- petrinet(name = "glb_analytics_pn",
                        trans_df = data.frame(id = 1:6,
    name = c("data.training.all","data.new",
           "model.selected","model.final",
           "data.training.all.prediction","data.new.prediction"),
    x=c(   -5,-5,-15,-25,-25,-35),
    y=c(   -5, 5,  0,  0, -5,  5)
                        ),
                        places_df=data.frame(id=1:4,
    name=c("bgn","fit.data.training.all","predict.data.new","end"),
    x=c(   -0,   -20,                    -30,               -40),
    y=c(    0,     0,                      0,                 0),
    M0=c(   3,     0,                      0,                 0)
                        ),
                        arcs_df = data.frame(
    begin = c("bgn","bgn","bgn",        
            "data.training.all","model.selected","fit.data.training.all",
            "fit.data.training.all","model.final",    
            "data.new","predict.data.new",
            "data.training.all.prediction","data.new.prediction"),
    end   = c("data.training.all","data.new","model.selected",
            "fit.data.training.all","fit.data.training.all","model.final",
            "data.training.all.prediction","predict.data.new",
            "predict.data.new","data.new.prediction",
            "end","end")
                        ))
#print(ggplot.petrinet(glb_analytics_pn))
print(ggplot.petrinet(glb_analytics_pn) + coord_flip())
## Loading required package: grid

glb_analytics_avl_objs <- NULL

glb_chunks_df <- myadd_chunk(NULL, 
                             ifelse(is.null(glbChunks$first), "import.data", glbChunks$first))
##          label step_major step_minor label_minor   bgn end elapsed
## 1 fit.models_1          1          0           0 9.489  NA      NA

Step 1.0: fit models_1

chunk option: eval=

Step 1.0: fit models_1

Step 1.0: fit models_1

```{r scrub.data, cache=FALSE, echo=FALSE, eval=myevlChunk(glbChunks, glbOut$pfx)}

Step 1.0: fit models_1

Step 1.0: fit models_1

Step 1.0: fit models_1

Step 1.0: fit models_1

```{r extract.features.image, cache=FALSE, echo=FALSE, fig.height=5, fig.width=5, eval=myevlChunk(glbChunks, glbOut$pfx)}

Step 1.0: fit models_1

Step 1.0: fit models_1

Step 1.0: fit models_1

Step 1.0: fit models_1

Step 1.0: fit models_1

Step 1.0: fit models_1

```{r cluster.data, cache=FALSE, echo=FALSE, eval=myevlChunk(glbChunks, glbOut$pfx)}

Step 1.0: fit models_1

Step 1.0: fit models_1

```{r select.features, cache=FALSE, echo=FALSE, eval=myevlChunk(glbChunks, glbOut$pfx)}

Step 1.0: fit models_1

fit.models_0_chunk_df <- myadd_chunk(NULL, "fit.models_0_bgn", label.minor = "setup")
# load(paste0(glbOut$pfx, "dsk.RData"))

glbgetModelSelectFormula <- function() {
    model_evl_terms <- c(NULL)
    # min.aic.fit might not be avl
    lclMdlEvlCriteria <- 
        glbMdlMetricsEval[glbMdlMetricsEval %in% names(glb_models_df)]
    for (metric in lclMdlEvlCriteria)
        model_evl_terms <- c(model_evl_terms, 
                             ifelse(length(grep("max", metric)) > 0, "-", "+"), metric)
    if (glb_is_classification && glb_is_binomial)
        model_evl_terms <- c(model_evl_terms, "-", "opt.prob.threshold.OOB")
    model_sel_frmla <- as.formula(paste(c("~ ", model_evl_terms), collapse = " "))
    return(model_sel_frmla)
}

glbgetDisplayModelsDf <- function() {
    dsp_models_cols <- c("id", 
                    glbMdlMetricsEval[glbMdlMetricsEval %in% names(glb_models_df)],
                    grep("opt.", names(glb_models_df), fixed = TRUE, value = TRUE)) 
    dsp_models_df <- 
        #orderBy(glbgetModelSelectFormula(), glb_models_df)[, c("id", glbMdlMetricsEval)]
        orderBy(glbgetModelSelectFormula(), glb_models_df)[, dsp_models_cols]    
    nCvMdl <- sapply(glb_models_lst, function(mdl) nrow(mdl$results))
    nParams <- sapply(glb_models_lst, function(mdl) ifelse(mdl$method == "custom", 0, 
        nrow(subset(modelLookup(mdl$method), parameter != "parameter"))))
    
#     nCvMdl <- nCvMdl[names(nCvMdl) != "avNNet"]
#     nParams <- nParams[names(nParams) != "avNNet"]    
    
    if (length(cvMdlProblems <- nCvMdl[nCvMdl <= nParams]) > 0) {
        print("Cross Validation issues:")
        warning("Cross Validation issues:")        
        print(cvMdlProblems)
    }
    
    pltMdls <- setdiff(names(nCvMdl), names(cvMdlProblems))
    pltMdls <- setdiff(pltMdls, names(nParams[nParams == 0]))
    
    # length(pltMdls) == 21
    png(paste0(glbOut$pfx, "bestTune.png"), width = 480 * 2, height = 480 * 4)
    grid.newpage()
    pushViewport(viewport(layout = grid.layout(ceiling(length(pltMdls) / 2.0), 2)))
    pltIx <- 1
    for (mdlId in pltMdls) {
        print(ggplot(glb_models_lst[[mdlId]], highBestTune = TRUE) + labs(title = mdlId),   
              vp = viewport(layout.pos.row = ceiling(pltIx / 2.0), 
                            layout.pos.col = ((pltIx - 1) %% 2) + 1))  
        pltIx <- pltIx + 1
    }
    dev.off()

    if (all(row.names(dsp_models_df) != dsp_models_df$id))
        row.names(dsp_models_df) <- dsp_models_df$id
    return(dsp_models_df)
}
#glbgetDisplayModelsDf()

glb_get_predictions <- function(df, mdl_id, rsp_var, prob_threshold_def=NULL, verbose=FALSE) {
    mdl <- glb_models_lst[[mdl_id]]
    
    clmnNames <- mygetPredictIds(rsp_var, mdl_id)
    predct_var_name <- clmnNames$value        
    predct_prob_var_name <- clmnNames$prob
    predct_accurate_var_name <- clmnNames$is.acc
    predct_error_var_name <- clmnNames$err
    predct_erabs_var_name <- clmnNames$err.abs

    if (glb_is_regression) {
        df[, predct_var_name] <- predict(mdl, newdata=df, type="raw")
        if (verbose) print(myplot_scatter(df, glb_rsp_var, predct_var_name) + 
                  facet_wrap(reformulate(glbFeatsCategory), scales = "free") + 
                  stat_smooth(method="glm"))

        df[, predct_error_var_name] <- df[, predct_var_name] - df[, glb_rsp_var]
        if (verbose) print(myplot_scatter(df, predct_var_name, predct_error_var_name) + 
                  #facet_wrap(reformulate(glbFeatsCategory), scales = "free") + 
                  stat_smooth(method="auto"))
        if (verbose) print(myplot_scatter(df, glb_rsp_var, predct_error_var_name) + 
                  #facet_wrap(reformulate(glbFeatsCategory), scales = "free") + 
                  stat_smooth(method="glm"))
        
        df[, predct_erabs_var_name] <- abs(df[, predct_error_var_name])
        if (verbose) print(head(orderBy(reformulate(c("-", predct_erabs_var_name)), df)))
        
        df[, predct_accurate_var_name] <- (df[, glb_rsp_var] == df[, predct_var_name])
    }

    if (glb_is_classification && glb_is_binomial) {
        prob_threshold <- glb_models_df[glb_models_df$id == mdl_id, 
                                        "opt.prob.threshold.OOB"]
        if (is.null(prob_threshold) || is.na(prob_threshold)) {
            warning("Using default probability threshold: ", prob_threshold_def)
            if (is.null(prob_threshold <- prob_threshold_def))
                stop("Default probability threshold is NULL")
        }
        
        df[, predct_prob_var_name] <- predict(mdl, newdata = df, type = "prob")[, 2]
        df[, predct_var_name] <- 
                factor(levels(df[, glb_rsp_var])[
                    (df[, predct_prob_var_name] >=
                        prob_threshold) * 1 + 1], levels(df[, glb_rsp_var]))
    
#         if (verbose) print(myplot_scatter(df, glb_rsp_var, predct_var_name) + 
#                   facet_wrap(reformulate(glbFeatsCategory), scales = "free") + 
#                   stat_smooth(method="glm"))

        df[, predct_error_var_name] <- df[, predct_var_name] != df[, glb_rsp_var]
#         if (verbose) print(myplot_scatter(df, predct_var_name, predct_error_var_name) + 
#                   #facet_wrap(reformulate(glbFeatsCategory), scales = "free") + 
#                   stat_smooth(method="auto"))
#         if (verbose) print(myplot_scatter(df, glb_rsp_var, predct_error_var_name) + 
#                   #facet_wrap(reformulate(glbFeatsCategory), scales = "free") + 
#                   stat_smooth(method="glm"))
        
        # if prediction is a TP (true +ve), measure distance from 1.0
        tp <- which((df[, predct_var_name] == df[, glb_rsp_var]) &
                    (df[, predct_var_name] == levels(df[, glb_rsp_var])[2]))
        df[tp, predct_erabs_var_name] <- abs(1 - df[tp, predct_prob_var_name])
        #rowIx <- which.max(df[tp, predct_erabs_var_name]); df[tp, c(glbFeatsId, glb_rsp_var, predct_var_name, predct_prob_var_name, predct_erabs_var_name)][rowIx, ]
        
        # if prediction is a TN (true -ve), measure distance from 0.0
        tn <- which((df[, predct_var_name] == df[, glb_rsp_var]) &
                    (df[, predct_var_name] == levels(df[, glb_rsp_var])[1]))
        df[tn, predct_erabs_var_name] <- abs(0 - df[tn, predct_prob_var_name])
        #rowIx <- which.max(df[tn, predct_erabs_var_name]); df[tn, c(glbFeatsId, glb_rsp_var, predct_var_name, predct_prob_var_name, predct_erabs_var_name)][rowIx, ]
        
        # if prediction is a FP (flse +ve), measure distance from 0.0
        fp <- which((df[, predct_var_name] != df[, glb_rsp_var]) &
                    (df[, predct_var_name] == levels(df[, glb_rsp_var])[2]))
        df[fp, predct_erabs_var_name] <- abs(0 - df[fp, predct_prob_var_name])
        #rowIx <- which.max(df[fp, predct_erabs_var_name]); df[fp, c(glbFeatsId, glb_rsp_var, predct_var_name, predct_prob_var_name, predct_erabs_var_name)][rowIx, ]
        
        # if prediction is a FN (flse -ve), measure distance from 1.0
        fn <- which((df[, predct_var_name] != df[, glb_rsp_var]) &
                    (df[, predct_var_name] == levels(df[, glb_rsp_var])[1]))
        df[fn, predct_erabs_var_name] <- abs(1 - df[fn, predct_prob_var_name])
        #rowIx <- which.max(df[fn, predct_erabs_var_name]); df[fn, c(glbFeatsId, glb_rsp_var, predct_var_name, predct_prob_var_name, predct_erabs_var_name)][rowIx, ]

        
        if (verbose) print(head(orderBy(reformulate(c("-", predct_erabs_var_name)), df)))
        
        df[, predct_accurate_var_name] <- (df[, glb_rsp_var] == df[, predct_var_name])
    }    
    
    if (glb_is_classification && !glb_is_binomial) {
        df[, predct_var_name] <- predict(mdl, newdata = df, type = "raw")
        probCls <- predict(mdl, newdata = df, type = "prob")        
        df[, predct_prob_var_name] <- NA
        for (cls in names(probCls)) {
            mask <- (df[, predct_var_name] == cls)
            df[mask, predct_prob_var_name] <- probCls[mask, cls]
        }    
        if (verbose) print(myplot_histogram(df, predct_prob_var_name, 
                                            fill_col_name = predct_var_name))
        if (verbose) print(myplot_histogram(df, predct_prob_var_name, 
                                            facet_frmla = paste0("~", glb_rsp_var)))
        
        df[, predct_error_var_name] <- df[, predct_var_name] != df[, glb_rsp_var]
        
        # if prediction is erroneous, measure predicted class prob from actual class prob
        df[, predct_erabs_var_name] <- 0
        for (cls in names(probCls)) {
            mask <- (df[, glb_rsp_var] == cls) & (df[, predct_error_var_name])
            df[mask, predct_erabs_var_name] <- probCls[mask, cls]
        }    

        df[, predct_accurate_var_name] <- (df[, glb_rsp_var] == df[, predct_var_name])        
    }

    return(df)
}    

if (glb_is_classification && glb_is_binomial && 
        (length(unique(glbObsFit[, glb_rsp_var])) < 2))
    stop("glbObsFit$", glb_rsp_var, ": contains less than 2 unique values: ",
         paste0(unique(glbObsFit[, glb_rsp_var]), collapse=", "))

max_cor_y_x_vars <- orderBy(~ -cor.y.abs, 
        subset(glb_feats_df, (exclude.as.feat == 0) & !nzv & !is.cor.y.abs.low & 
                                is.na(cor.high.X)))[1:2, "id"]
max_cor_y_x_vars <- max_cor_y_x_vars[!is.na(max_cor_y_x_vars)]
if (length(max_cor_y_x_vars) < 2)
    max_cor_y_x_vars <- union(max_cor_y_x_vars, ".pos")

if (!is.null(glb_Baseline_mdl_var)) {
    if ((max_cor_y_x_vars[1] != glb_Baseline_mdl_var) & 
        (glb_feats_df[glb_feats_df$id == max_cor_y_x_vars[1], "cor.y.abs"] > 
         glb_feats_df[glb_feats_df$id == glb_Baseline_mdl_var, "cor.y.abs"]))
        stop(max_cor_y_x_vars[1], " has a higher correlation with ", glb_rsp_var, 
             " than the Baseline var: ", glb_Baseline_mdl_var)
}

glb_model_type <- ifelse(glb_is_regression, "regression", "classification")
    
# Model specs
# c("id.prefix", "method", "type",
#   # trainControl params
#   "preProc.method", "cv.n.folds", "cv.n.repeats", "summary.fn",
#   # train params
#   "metric", "metric.maximize", "tune.df")

# Baseline
if (!is.null(glb_Baseline_mdl_var)) {
    fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df, 
                            paste0("fit.models_0_", "Baseline"), major.inc = FALSE,
                                    label.minor = "mybaseln_classfr")
    ret_lst <- myfit_mdl(mdl_id="Baseline", 
                         model_method="mybaseln_classfr",
                        indepVar=glb_Baseline_mdl_var,
                        rsp_var=glb_rsp_var,
                        fit_df=glbObsFit, OOB_df=glbObsOOB)
}    

# Most Frequent Outcome "MFO" model: mean(y) for regression
#   Not using caret's nullModel since model stats not avl
#   Cannot use rpart for multinomial classification since it predicts non-MFO
if (glb_is_classification) {
    fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df, 
                                paste0("fit.models_0_", "MFO"), major.inc = FALSE,
                                        label.minor = "myMFO_classfr")

    ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
        id.prefix = "MFO", type = glb_model_type, trainControl.method = "none",
        train.method = ifelse(glb_is_regression, "lm", "myMFO_classfr"))),
                            indepVar = ".rnorm", rsp_var = glb_rsp_var,
                            fit_df = glbObsFit, OOB_df = glbObsOOB)

        # "random" model - only for classification; 
        #   none needed for regression since it is same as MFO
    fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df, 
                                paste0("fit.models_0_", "Random"), major.inc = FALSE,
                                        label.minor = "myrandom_classfr")

#stop(here"); glb2Sav(); all.equal(glb_models_df, sav_models_df)    
    ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
        id.prefix = "Random", type = glb_model_type, trainControl.method = "none",
        train.method = "myrandom_classfr")),
                        indepVar = ".rnorm", rsp_var = glb_rsp_var,
                        fit_df = glbObsFit, OOB_df = glbObsOOB)
}

# Max.cor.Y
#   Check impact of cv
#       rpart is not a good candidate since caret does not optimize cp (only tuning parameter of rpart) well
fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df, 
                        paste0("fit.models_0_", "Max.cor.Y.rcv.*X*"), major.inc = FALSE,
                                    label.minor = "glmnet")

ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
    id.prefix = "Max.cor.Y.rcv.1X1", type = glb_model_type, trainControl.method = "none",
    train.method = "glmnet")),
                    indepVar = max_cor_y_x_vars, rsp_var = glb_rsp_var, 
                    fit_df = glbObsFit, OOB_df = glbObsOOB)

if (glbMdlCheckRcv) {
    # rcv_n_folds == 1 & rcv_n_repeats > 1 crashes
    for (rcv_n_folds in seq(3, glb_rcv_n_folds + 2, 2))
        for (rcv_n_repeats in seq(1, glb_rcv_n_repeats + 2, 2)) {
            
            # Experiment specific code to avoid caret crash
    #         lcl_tune_models_df <- rbind(data.frame()
    #                             ,data.frame(method = "glmnet", parameter = "alpha", 
    #                                         vals = "0.100 0.325 0.550 0.775 1.000")
    #                             ,data.frame(method = "glmnet", parameter = "lambda",
    #                                         vals = "9.342e-02")    
    #                                     )
            
            ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst =
                list(
                id.prefix = paste0("Max.cor.Y.rcv.", rcv_n_folds, "X", rcv_n_repeats), 
                type = glb_model_type, 
    # tune.df = lcl_tune_models_df,            
                trainControl.method = "repeatedcv",
                trainControl.number = rcv_n_folds, 
                trainControl.repeats = rcv_n_repeats,
                trainControl.classProbs = glb_is_classification,
                trainControl.summaryFunction = glbMdlMetricSummaryFn,
                train.method = "glmnet", train.metric = glbMdlMetricSummary, 
                train.maximize = glbMdlMetricMaximize)),
                                indepVar = max_cor_y_x_vars, rsp_var = glb_rsp_var, 
                                fit_df = glbObsFit, OOB_df = glbObsOOB)
        }
    # Add parallel coordinates graph of glb_models_df[, glbMdlMetricsEval] to evaluate cv parameters
    tmp_models_cols <- c("id", "max.nTuningRuns",
                        glbMdlMetricsEval[glbMdlMetricsEval %in% names(glb_models_df)],
                        grep("opt.", names(glb_models_df), fixed = TRUE, value = TRUE)) 
    print(myplot_parcoord(obs_df = subset(glb_models_df, 
                                          grepl("Max.cor.Y.rcv.", id, fixed = TRUE), 
                                            select = -feats)[, tmp_models_cols],
                          id_var = "id"))
}
        
# Useful for stacking decisions
# fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df, 
#                     paste0("fit.models_0_", "Max.cor.Y[rcv.1X1.cp.0|]"), major.inc = FALSE,
#                                     label.minor = "rpart")
# 
# ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
#     id.prefix = "Max.cor.Y.rcv.1X1.cp.0", type = glb_model_type, trainControl.method = "none",
#     train.method = "rpart",
#     tune.df=data.frame(method="rpart", parameter="cp", min=0.0, max=0.0, by=0.1))),
#                     indepVar=max_cor_y_x_vars, rsp_var=glb_rsp_var, 
#                     fit_df=glbObsFit, OOB_df=glbObsOOB)

#stop(here"); glb2Sav(); all.equal(glb_models_df, sav_models_df)
# if (glb_is_regression || glb_is_binomial) # For multinomials this model will be run next by default
ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
                        id.prefix = "Max.cor.Y", 
                        type = glb_model_type, trainControl.method = "repeatedcv",
                        trainControl.number = glb_rcv_n_folds, 
                        trainControl.repeats = glb_rcv_n_repeats,
                        trainControl.classProbs = glb_is_classification,
                        trainControl.summaryFunction = glbMdlMetricSummaryFn,
                        trainControl.allowParallel = glbMdlAllowParallel,                        
                        train.metric = glbMdlMetricSummary, 
                        train.maximize = glbMdlMetricMaximize,    
                        train.method = "rpart")),
                    indepVar = max_cor_y_x_vars, rsp_var = glb_rsp_var, 
                    fit_df = glbObsFit, OOB_df = glbObsOOB)

if ((length(glbFeatsDateTime) > 0) && 
    (sum(grepl(paste(names(glbFeatsDateTime), "\\.day\\.minutes\\.poly\\.", sep = ""),
               names(glbObsAll))) > 0)) {
    fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df, 
                    paste0("fit.models_0_", "Max.cor.Y.Time.Poly"), major.inc = FALSE,
                                    label.minor = "glmnet")

    indepVars <- c(max_cor_y_x_vars, 
            grep(paste(names(glbFeatsDateTime), "\\.day\\.minutes\\.poly\\.", sep = ""),
                        names(glbObsAll), value = TRUE))
    indepVars <- myadjustInteractionFeats(glb_feats_df, indepVars)
    ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
            id.prefix = "Max.cor.Y.Time.Poly", 
            type = glb_model_type, trainControl.method = "repeatedcv",
            trainControl.number = glb_rcv_n_folds, trainControl.repeats = glb_rcv_n_repeats,
            trainControl.classProbs = glb_is_classification,
            trainControl.summaryFunction = glbMdlMetricSummaryFn,
            trainControl.allowParallel = glbMdlAllowParallel,            
            train.metric = glbMdlMetricSummary, 
            train.maximize = glbMdlMetricMaximize,    
            train.method = "glmnet")),
        indepVar = indepVars,
        rsp_var = glb_rsp_var, 
        fit_df = glbObsFit, OOB_df = glbObsOOB)
}

if ((length(glbFeatsDateTime) > 0) && 
    (sum(grepl(paste(names(glbFeatsDateTime), "\\.last[[:digit:]]", sep = ""),
               names(glbObsAll))) > 0)) {
    fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df, 
                    paste0("fit.models_0_", "Max.cor.Y.Time.Lag"), major.inc = FALSE,
                                    label.minor = "glmnet")

    indepVars <- c(max_cor_y_x_vars, 
            grep(paste(names(glbFeatsDateTime), "\\.last[[:digit:]]", sep = ""),
                        names(glbObsAll), value = TRUE))
    indepVars <- myadjustInteractionFeats(glb_feats_df, indepVars)
    ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
        id.prefix = "Max.cor.Y.Time.Lag", 
        type = glb_model_type, 
        tune.df = glbMdlTuneParams,        
        trainControl.method = "repeatedcv",
        trainControl.number = glb_rcv_n_folds, trainControl.repeats = glb_rcv_n_repeats,
        trainControl.classProbs = glb_is_classification,
        trainControl.summaryFunction = glbMdlMetricSummaryFn,
        trainControl.allowParallel = glbMdlAllowParallel,        
        train.metric = glbMdlMetricSummary, 
        train.maximize = glbMdlMetricMaximize,    
        train.method = "glmnet")),
        indepVar = indepVars,
        rsp_var = glb_rsp_var, 
        fit_df = glbObsFit, OOB_df = glbObsOOB)
}

if (length(glbFeatsText) > 0) {
    fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df, 
                    paste0("fit.models_0_", "Txt.*"), major.inc = FALSE,
                                    label.minor = "glmnet")

    indepVars <- c(max_cor_y_x_vars)
    for (txtFeat in names(glbFeatsText))
        indepVars <- union(indepVars, 
            grep(paste(str_to_upper(substr(txtFeat, 1, 1)), "\\.(?!([T|P]\\.))", sep = ""),
                        names(glbObsAll), perl = TRUE, value = TRUE))
    indepVars <- myadjustInteractionFeats(glb_feats_df, indepVars)
    ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
        id.prefix = "Max.cor.Y.Text.nonTP", 
        type = glb_model_type, 
        tune.df = glbMdlTuneParams,        
        trainControl.method = "repeatedcv",
        trainControl.number = glb_rcv_n_folds, trainControl.repeats = glb_rcv_n_repeats,
        trainControl.classProbs = glb_is_classification,
        trainControl.summaryFunction = glbMdlMetricSummaryFn,
        trainControl.allowParallel = glbMdlAllowParallel,                                
        train.metric = glbMdlMetricSummary, 
        train.maximize = glbMdlMetricMaximize,    
        train.method = "glmnet")),
        indepVar = indepVars,
        rsp_var = glb_rsp_var, 
        fit_df = glbObsFit, OOB_df = glbObsOOB)

    indepVars <- c(max_cor_y_x_vars)
    for (txtFeat in names(glbFeatsText))
        indepVars <- union(indepVars, 
            grep(paste(str_to_upper(substr(txtFeat, 1, 1)), "\\.T\\.", sep = ""),
                        names(glbObsAll), perl = TRUE, value = TRUE))
    indepVars <- myadjustInteractionFeats(glb_feats_df, indepVars)
    ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
        id.prefix = "Max.cor.Y.Text.onlyT", 
        type = glb_model_type, 
        tune.df = glbMdlTuneParams,        
        trainControl.method = "repeatedcv",
        trainControl.number = glb_rcv_n_folds, trainControl.repeats = glb_rcv_n_repeats,
        trainControl.classProbs = glb_is_classification,
        trainControl.summaryFunction = glbMdlMetricSummaryFn,
        train.metric = glbMdlMetricSummary, 
        train.maximize = glbMdlMetricMaximize,    
        train.method = "glmnet")),
        indepVar = indepVars,
        rsp_var = glb_rsp_var, 
        fit_df = glbObsFit, OOB_df = glbObsOOB)

    indepVars <- c(max_cor_y_x_vars)
    for (txtFeat in names(glbFeatsText))
        indepVars <- union(indepVars, 
            grep(paste(str_to_upper(substr(txtFeat, 1, 1)), "\\.P\\.", sep = ""),
                        names(glbObsAll), perl = TRUE, value = TRUE))
    indepVars <- myadjustInteractionFeats(glb_feats_df, indepVars)
    ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
        id.prefix = "Max.cor.Y.Text.onlyP", 
        type = glb_model_type, 
        tune.df = glbMdlTuneParams,        
        trainControl.method = "repeatedcv",
        trainControl.number = glb_rcv_n_folds, trainControl.repeats = glb_rcv_n_repeats,
        trainControl.classProbs = glb_is_classification,
        trainControl.summaryFunction = glbMdlMetricSummaryFn,
        trainControl.allowParallel = glbMdlAllowParallel,        
        train.metric = glbMdlMetricSummary, 
        train.maximize = glbMdlMetricMaximize,    
        train.method = "glmnet")),
        indepVar = indepVars,
        rsp_var = glb_rsp_var, 
        fit_df = glbObsFit, OOB_df = glbObsOOB)
}

# Interactions.High.cor.Y
if (length(int_feats <- setdiff(setdiff(unique(glb_feats_df$cor.high.X), NA), 
                                subset(glb_feats_df, nzv)$id)) > 0) {
    fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df, 
                    paste0("fit.models_0_", "Interact.High.cor.Y"), major.inc = FALSE,
                                    label.minor = "glmnet")

    ret_lst <- myfit_mdl(mdl_specs_lst=myinit_mdl_specs_lst(mdl_specs_lst=list(
        id.prefix="Interact.High.cor.Y", 
        type=glb_model_type, trainControl.method="repeatedcv",
        trainControl.number=glb_rcv_n_folds, trainControl.repeats=glb_rcv_n_repeats,
        trainControl.classProbs = glb_is_classification,
        trainControl.summaryFunction = glbMdlMetricSummaryFn,
        trainControl.allowParallel = glbMdlAllowParallel,
        train.metric = glbMdlMetricSummary, 
        train.maximize = glbMdlMetricMaximize,    
        train.method="glmnet")),
        indepVar=c(max_cor_y_x_vars, paste(max_cor_y_x_vars[1], int_feats, sep=":")),
        rsp_var=glb_rsp_var, 
        fit_df=glbObsFit, OOB_df=glbObsOOB)
}    

# Low.cor.X
fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df, 
                        paste0("fit.models_0_", "Low.cor.X"), major.inc = FALSE,
                                     label.minor = "glmnet")
indepVar <- mygetIndepVar(glb_feats_df)
indepVar <- setdiff(indepVar, unique(glb_feats_df$cor.high.X))
ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
            id.prefix = "Low.cor.X", 
            type = glb_model_type, 
            tune.df = glbMdlTuneParams,        
            trainControl.method = "repeatedcv",
            trainControl.number = glb_rcv_n_folds, trainControl.repeats = glb_rcv_n_repeats,
            trainControl.classProbs = glb_is_classification,
            trainControl.summaryFunction = glbMdlMetricSummaryFn,
            trainControl.allowParallel = glbMdlAllowParallel,
            train.metric = glbMdlMetricSummary, 
            train.maximize = glbMdlMetricMaximize,    
            train.method = "glmnet")),
        indepVar = indepVar, rsp_var = glb_rsp_var, 
        fit_df = glbObsFit, OOB_df = glbObsOOB)

fit.models_0_chunk_df <- 
    myadd_chunk(fit.models_0_chunk_df, "fit.models_0_end", major.inc = FALSE,
                label.minor = "teardown")

rm(ret_lst)

glb_chunks_df <- myadd_chunk(glb_chunks_df, "fit.models", major.inc = FALSE)

```{r fit.models_1, cache=FALSE, fig.height=10, fig.width=15, eval=myevlChunk(glbChunks, glbOut$pfx)}

##              label step_major step_minor label_minor    bgn end elapsed
## 1 fit.models_1_bgn          1          0       setup 11.909  NA      NA
##                label step_major step_minor label_minor    bgn    end
## 1   fit.models_1_bgn          1          0       setup 11.909 11.917
## 2 fit.models_1_All.X          1          1       setup 11.917     NA
##   elapsed
## 1   0.008
## 2      NA
##                label step_major step_minor label_minor    bgn    end
## 2 fit.models_1_All.X          1          1       setup 11.917 12.142
## 3 fit.models_1_All.X          1          2      glmnet 12.142     NA
##   elapsed
## 2   0.225
## 3      NA
## [1] "myfit_mdl: enter: 0.000000 secs"
## [1] "myfit_mdl: fitting model: All.X##rcv#glmnet"
## [1] "    indepVar: Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff"
## [1] "myfit_mdl: setup complete: 0.640000 secs"
## Loading required package: glmnet
## Loading required package: Matrix
## Loaded glmnet 2.0-5
## Aggregating results
## Selecting tuning parameters
## Fitting alpha = 0.325, lambda = 0.07 on full training set
## [1] "myfit_mdl: train complete: 14.016000 secs"

##             Length Class      Mode     
## a0             84  -none-     numeric  
## beta        21084  dgCMatrix  S4       
## df             84  -none-     numeric  
## dim             2  -none-     numeric  
## lambda         84  -none-     numeric  
## dev.ratio      84  -none-     numeric  
## nulldev         1  -none-     numeric  
## npasses         1  -none-     numeric  
## jerr            1  -none-     numeric  
## offset          1  -none-     logical  
## classnames      2  -none-     character
## call            5  -none-     call     
## nobs            1  -none-     numeric  
## lambdaOpt       1  -none-     numeric  
## xNames        251  -none-     character
## problemType     1  -none-     character
## tuneValue       2  data.frame list     
## obsLevels       2  -none-     character
## [1] "min lambda > lambdaOpt:"
##       (Intercept)     Hhold.fctrMKy     Hhold.fctrPKn   Q101163.fctrDad 
##        0.27061370        0.01326647       -0.08819781        0.07411111 
##    Q106997.fctrGr  Q108855.fctrYes!    Q110740.fctrPC    Q113181.fctrNo 
##        0.02012811        0.03730920        0.01312634       -0.13669409 
##   Q113181.fctrYes    Q115611.fctrNo   Q115611.fctrYes Q116881.fctrRight 
##        0.10839201       -0.13908704        0.31297357        0.14556708 
##   Q122120.fctrYes     Q98197.fctrNo     Q98869.fctrNo     Q99480.fctrNo 
##        0.01981429       -0.13048792       -0.06873957       -0.06847183 
## [1] "max lambda < lambdaOpt:"
##         (Intercept)       Hhold.fctrMKy       Hhold.fctrPKn 
##        0.2475835836        0.0224233321       -0.1265747584 
##     Q101163.fctrDad     Q106388.fctrYes      Q106997.fctrGr 
##        0.0865172276        0.0005144989        0.0398301715 
##    Q108855.fctrYes!      Q110740.fctrPC      Q113181.fctrNo 
##        0.0520950487        0.0269135343       -0.1493928760 
##     Q113181.fctrYes      Q115611.fctrNo     Q115611.fctrYes 
##        0.1048488591       -0.1510882682        0.3176426185 
##   Q116881.fctrRight Q120472.fctrScience     Q122120.fctrYes 
##        0.1615497402        0.0010406929        0.0384779635 
##     Q123621.fctrYes       Q98197.fctrNo       Q98869.fctrNo 
##        0.0072895215       -0.1388728256       -0.0828083261 
##       Q99480.fctrNo 
##       -0.0813131230 
## [1] "myfit_mdl: train diagnostics complete: 14.530000 secs"
## Loading required namespace: pROC
## Loading required package: ROCR
## Loading required package: gplots
## 
## Attaching package: 'gplots'
## The following object is masked from 'package:stats':
## 
##     lowess

## Loading required package: sqldf
## Loading required package: gsubfn
## Loading required package: proto
## Loading required package: RSQLite
## Loading required package: DBI
## Loading required package: tcltk

##          Prediction
## Reference   D   R
##         D 414 415
##         R 319 816
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   6.262729e-01   2.218020e-01   6.044463e-01   6.477217e-01   5.779022e-01 
## AccuracyPValue  McnemarPValue 
##   7.059185e-06   4.540176e-04

##          Prediction
## Reference   D   R
##         D  50 159
##         R  47 239
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   5.838384e-01   8.072194e-02   5.390116e-01   6.276579e-01   5.777778e-01 
## AccuracyPValue  McnemarPValue 
##   4.109019e-01   1.044351e-14 
## [1] "myfit_mdl: predict complete: 26.546000 secs"
##                  id
## 1 All.X##rcv#glmnet
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             feats
## 1 Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff
##   max.nTuningRuns min.elapsedtime.everything min.elapsedtime.final
## 1              25                     13.297                 1.278
##   max.AUCpROC.fit max.Sens.fit max.Spec.fit max.AUCROCR.fit
## 1       0.5754271    0.2882992    0.8625551       0.6573027
##   opt.prob.threshold.fit max.f.score.fit max.Accuracy.fit
## 1                   0.55       0.6897718          0.60947
##   max.AccuracyLower.fit max.AccuracyUpper.fit max.Kappa.fit
## 1             0.6044463             0.6477217     0.1376453
##   max.AUCpROC.OOB max.Sens.OOB max.Spec.OOB max.AUCROCR.OOB
## 1       0.5374494    0.2392344    0.8356643        0.563188
##   opt.prob.threshold.OOB max.f.score.OOB max.Accuracy.OOB
## 1                    0.5       0.6988304        0.5838384
##   max.AccuracyLower.OOB max.AccuracyUpper.OOB max.Kappa.OOB
## 1             0.5390116             0.6276579    0.08072194
##   max.AccuracySD.fit max.KappaSD.fit
## 1         0.01543059      0.03009977
## [1] "myfit_mdl: exit: 26.808000 secs"
##                  label step_major step_minor label_minor    bgn    end
## 3   fit.models_1_All.X          1          2      glmnet 12.142 38.975
## 4 fit.models_1_preProc          1          3     preProc 38.976     NA
##   elapsed
## 3  26.833
## 4      NA
## Loading required package: gdata
## gdata: read.xls support for 'XLS' (Excel 97-2004) files ENABLED.
## 
## gdata: read.xls support for 'XLSX' (Excel 2007+) files ENABLED.
## 
## Attaching package: 'gdata'
## The following objects are masked from 'package:dplyr':
## 
##     combine, first, last
## The following object is masked from 'package:stats':
## 
##     nobs
## The following object is masked from 'package:utils':
## 
##     object.size
## [1] "myfit_mdl: enter: 0.000000 secs"
## [1] "myfit_mdl: fitting model: All.X#zv#rcv#glmnet"
## [1] "    indepVar: Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff"
## [1] "myfit_mdl: setup complete: 0.683000 secs"
## Aggregating results
## Selecting tuning parameters
## Fitting alpha = 0.55, lambda = 0.0376 on full training set
## [1] "myfit_mdl: train complete: 15.811000 secs"
## Warning in myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst =
## list(id.prefix = bstMdlIdComponents$family, : model's bestTune found at an
## extreme of tuneGrid for parameter: lambda

##             Length Class      Mode     
## a0             82  -none-     numeric  
## beta        20172  dgCMatrix  S4       
## df             82  -none-     numeric  
## dim             2  -none-     numeric  
## lambda         82  -none-     numeric  
## dev.ratio      82  -none-     numeric  
## nulldev         1  -none-     numeric  
## npasses         1  -none-     numeric  
## jerr            1  -none-     numeric  
## offset          1  -none-     logical  
## classnames      2  -none-     character
## call            5  -none-     call     
## nobs            1  -none-     numeric  
## lambdaOpt       1  -none-     numeric  
## xNames        246  -none-     character
## problemType     1  -none-     character
## tuneValue       2  data.frame list     
## obsLevels       2  -none-     character
## [1] "min lambda > lambdaOpt:"
##       (Intercept)     Hhold.fctrMKy     Hhold.fctrPKn   Q101163.fctrDad 
##        0.23798411        0.01874708       -0.13442634        0.09255838 
##    Q106997.fctrGr  Q108855.fctrYes!    Q110740.fctrPC    Q113181.fctrNo 
##        0.04606394        0.05583211        0.02832168       -0.17278645 
##   Q113181.fctrYes    Q115611.fctrNo   Q115611.fctrYes Q116881.fctrRight 
##        0.08695903       -0.13399486        0.36549211        0.17630958 
##   Q122120.fctrYes   Q123621.fctrYes     Q98197.fctrNo     Q98869.fctrNo 
##        0.04163127        0.00229355       -0.14923426       -0.08488000 
##     Q99480.fctrNo 
##       -0.08339722 
## [1] "max lambda < lambdaOpt:"
##         (Intercept)       Hhold.fctrMKy       Hhold.fctrPKn 
##         0.216260115         0.027552836        -0.172608767 
##     Q101163.fctrDad     Q106388.fctrYes      Q106997.fctrGr 
##         0.104315647         0.004549068         0.066207479 
##    Q108855.fctrYes!      Q110740.fctrPC      Q113181.fctrNo 
##         0.071265356         0.042228759        -0.188579678 
##     Q113181.fctrYes      Q115611.fctrNo     Q115611.fctrYes 
##         0.078590932        -0.148973794         0.363232265 
##   Q116881.fctrRight Q120472.fctrScience     Q122120.fctrYes 
##         0.190801458         0.009230062         0.061075685 
##     Q123621.fctrYes       Q98197.fctrNo       Q98869.fctrNo 
##         0.010278853        -0.157484555        -0.099872253 
##       Q99480.fctrNo 
##        -0.095613180 
## [1] "myfit_mdl: train diagnostics complete: 16.481000 secs"

##          Prediction
## Reference   D   R
##         D 429 400
##         R 322 813
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   6.323829e-01   2.367939e-01   6.106194e-01   6.537503e-01   5.779022e-01 
## AccuracyPValue  McnemarPValue 
##   4.843674e-07   4.161629e-03

##          Prediction
## Reference   D   R
##         D  16 193
##         R   8 278
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   5.939394e-01   5.515512e-02   5.492118e-01   6.375382e-01   5.777778e-01 
## AccuracyPValue  McnemarPValue 
##   2.478775e-01   1.623204e-38 
## [1] "myfit_mdl: predict complete: 25.844000 secs"
##                    id
## 1 All.X#zv#rcv#glmnet
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             feats
## 1 Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff
##   max.nTuningRuns min.elapsedtime.everything min.elapsedtime.final
## 1              25                     15.047                 1.361
##   max.AUCpROC.fit max.Sens.fit max.Spec.fit max.AUCROCR.fit
## 1       0.5838976     0.318456    0.8493392       0.6603466
##   opt.prob.threshold.fit max.f.score.fit max.Accuracy.fit
## 1                   0.55       0.6925043        0.6098108
##   max.AccuracyLower.fit max.AccuracyUpper.fit max.Kappa.fit
## 1             0.6106194             0.6537503     0.1457828
##   max.AUCpROC.OOB max.Sens.OOB max.Spec.OOB max.AUCROCR.OOB
## 1       0.5441664    0.2631579    0.8251748       0.5655804
##   opt.prob.threshold.OOB max.f.score.OOB max.Accuracy.OOB
## 1                   0.45       0.7344782        0.5939394
##   max.AccuracyLower.OOB max.AccuracyUpper.OOB max.Kappa.OOB
## 1             0.5492118             0.6375382    0.05515512
##   max.AccuracySD.fit max.KappaSD.fit
## 1         0.01567398      0.03089611
## [1] "myfit_mdl: exit: 26.131000 secs"
## [1] "myfit_mdl: enter: 0.000000 secs"
## [1] "myfit_mdl: fitting model: All.X#nzv#rcv#glmnet"
## [1] "    indepVar: Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff"
## [1] "myfit_mdl: setup complete: 0.667000 secs"
## Aggregating results
## Selecting tuning parameters
## Fitting alpha = 0.55, lambda = 0.0376 on full training set
## [1] "myfit_mdl: train complete: 19.949000 secs"
## Warning in myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst =
## list(id.prefix = bstMdlIdComponents$family, : model's bestTune found at an
## extreme of tuneGrid for parameter: lambda

##             Length Class      Mode     
## a0             81  -none-     numeric  
## beta        18630  dgCMatrix  S4       
## df             81  -none-     numeric  
## dim             2  -none-     numeric  
## lambda         81  -none-     numeric  
## dev.ratio      81  -none-     numeric  
## nulldev         1  -none-     numeric  
## npasses         1  -none-     numeric  
## jerr            1  -none-     numeric  
## offset          1  -none-     logical  
## classnames      2  -none-     character
## call            5  -none-     call     
## nobs            1  -none-     numeric  
## lambdaOpt       1  -none-     numeric  
## xNames        230  -none-     character
## problemType     1  -none-     character
## tuneValue       2  data.frame list     
## obsLevels       2  -none-     character
## [1] "min lambda > lambdaOpt:"
##       (Intercept)     Hhold.fctrMKy   Q101163.fctrDad    Q106997.fctrGr 
##       0.232995281       0.023468084       0.093140617       0.046368107 
##  Q108855.fctrYes!    Q110740.fctrPC    Q113181.fctrNo   Q113181.fctrYes 
##       0.056116163       0.028904547      -0.171850825       0.086450820 
##    Q115611.fctrNo   Q115611.fctrYes Q116881.fctrRight   Q122120.fctrYes 
##      -0.133769688       0.365911659       0.177911953       0.041674684 
##   Q123621.fctrYes     Q98197.fctrNo     Q98869.fctrNo     Q99480.fctrNo 
##       0.001364229      -0.151313553      -0.086095991      -0.084573309 
## [1] "max lambda < lambdaOpt:"
##         (Intercept)       Hhold.fctrMKy     Q101163.fctrDad 
##         0.209866910         0.033813656         0.105064367 
##     Q106388.fctrYes      Q106997.fctrGr    Q108855.fctrYes! 
##         0.003565671         0.066629915         0.071616017 
##      Q110740.fctrPC      Q113181.fctrNo     Q113181.fctrYes 
##         0.042967516        -0.187381186         0.077929007 
##      Q115611.fctrNo     Q115611.fctrYes   Q116881.fctrRight 
##        -0.148722825         0.363774514         0.192898198 
## Q120472.fctrScience     Q122120.fctrYes     Q123621.fctrYes 
##         0.009453961         0.061093106         0.009228911 
##       Q98197.fctrNo       Q98869.fctrNo       Q99480.fctrNo 
##        -0.160184243        -0.101480408        -0.097117632 
## [1] "myfit_mdl: train diagnostics complete: 20.610000 secs"

##          Prediction
## Reference   D   R
##         D 423 406
##         R 317 818
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   6.318737e-01   2.343497e-01   6.101049e-01   6.532481e-01   5.779022e-01 
## AccuracyPValue  McnemarPValue 
##   6.125960e-07   1.065047e-03

##          Prediction
## Reference   D   R
##         D  14 195
##         R   7 279
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   5.919192e-01   4.836683e-02   5.471702e-01   6.355636e-01   5.777778e-01 
## AccuracyPValue  McnemarPValue 
##   2.776271e-01   1.545622e-39 
## [1] "myfit_mdl: predict complete: 29.893000 secs"
##                     id
## 1 All.X#nzv#rcv#glmnet
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             feats
## 1 Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff
##   max.nTuningRuns min.elapsedtime.everything min.elapsedtime.final
## 1              25                     19.195                 2.122
##   max.AUCpROC.fit max.Sens.fit max.Spec.fit max.AUCROCR.fit
## 1       0.5843381     0.318456    0.8502203       0.6584261
##   opt.prob.threshold.fit max.f.score.fit max.Accuracy.fit
## 1                   0.55       0.6935142        0.6086221
##   max.AccuracyLower.fit max.AccuracyUpper.fit max.Kappa.fit
## 1             0.6101049             0.6532481     0.1430231
##   max.AUCpROC.OOB max.Sens.OOB max.Spec.OOB max.AUCROCR.OOB
## 1       0.5358852    0.2535885    0.8181818       0.5617158
##   opt.prob.threshold.OOB max.f.score.OOB max.Accuracy.OOB
## 1                   0.45       0.7342105        0.5919192
##   max.AccuracyLower.OOB max.AccuracyUpper.OOB max.Kappa.OOB
## 1             0.5471702             0.6355636    0.04836683
##   max.AccuracySD.fit max.KappaSD.fit
## 1         0.01616259       0.0321425
## [1] "myfit_mdl: exit: 30.167000 secs"
## [1] "myfit_mdl: enter: 0.000000 secs"
## [1] "myfit_mdl: fitting model: All.X#BoxCox#rcv#glmnet"
## [1] "    indepVar: Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff"
## [1] "myfit_mdl: setup complete: 0.989000 secs"
## Aggregating results
## Selecting tuning parameters
## Fitting alpha = 0.55, lambda = 0.0376 on full training set
## Warning in is.na(lam): is.na() applied to non-(list or vector) of type
## 'NULL'

## [1] "myfit_mdl: train complete: 18.150000 secs"
## Warning in myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst =
## list(id.prefix = bstMdlIdComponents$family, : model's bestTune found at an
## extreme of tuneGrid for parameter: lambda

##             Length Class      Mode     
## a0             82  -none-     numeric  
## beta        20582  dgCMatrix  S4       
## df             82  -none-     numeric  
## dim             2  -none-     numeric  
## lambda         82  -none-     numeric  
## dev.ratio      82  -none-     numeric  
## nulldev         1  -none-     numeric  
## npasses         1  -none-     numeric  
## jerr            1  -none-     numeric  
## offset          1  -none-     logical  
## classnames      2  -none-     character
## call            5  -none-     call     
## nobs            1  -none-     numeric  
## lambdaOpt       1  -none-     numeric  
## xNames        251  -none-     character
## problemType     1  -none-     character
## tuneValue       2  data.frame list     
## obsLevels       2  -none-     character
## [1] "min lambda > lambdaOpt:"
##       (Intercept)     Hhold.fctrMKy     Hhold.fctrPKn   Q101163.fctrDad 
##        0.23798411        0.01874708       -0.13442634        0.09255838 
##    Q106997.fctrGr  Q108855.fctrYes!    Q110740.fctrPC    Q113181.fctrNo 
##        0.04606394        0.05583211        0.02832168       -0.17278645 
##   Q113181.fctrYes    Q115611.fctrNo   Q115611.fctrYes Q116881.fctrRight 
##        0.08695903       -0.13399486        0.36549211        0.17630958 
##   Q122120.fctrYes   Q123621.fctrYes     Q98197.fctrNo     Q98869.fctrNo 
##        0.04163127        0.00229355       -0.14923426       -0.08488000 
##     Q99480.fctrNo 
##       -0.08339722 
## [1] "max lambda < lambdaOpt:"
##         (Intercept)       Hhold.fctrMKy       Hhold.fctrPKn 
##         0.216260115         0.027552836        -0.172608767 
##     Q101163.fctrDad     Q106388.fctrYes      Q106997.fctrGr 
##         0.104315647         0.004549068         0.066207479 
##    Q108855.fctrYes!      Q110740.fctrPC      Q113181.fctrNo 
##         0.071265356         0.042228759        -0.188579678 
##     Q113181.fctrYes      Q115611.fctrNo     Q115611.fctrYes 
##         0.078590932        -0.148973794         0.363232265 
##   Q116881.fctrRight Q120472.fctrScience     Q122120.fctrYes 
##         0.190801458         0.009230062         0.061075685 
##     Q123621.fctrYes       Q98197.fctrNo       Q98869.fctrNo 
##         0.010278853        -0.157484555        -0.099872253 
##       Q99480.fctrNo 
##        -0.095613180 
## [1] "myfit_mdl: train diagnostics complete: 18.802000 secs"
## Warning in is.na(lam): is.na() applied to non-(list or vector) of type
## 'NULL'
## Warning in is.na(lam): is.na() applied to non-(list or vector) of type
## 'NULL'

##          Prediction
## Reference   D   R
##         D 429 400
##         R 322 813
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   6.323829e-01   2.367939e-01   6.106194e-01   6.537503e-01   5.779022e-01 
## AccuracyPValue  McnemarPValue 
##   4.843674e-07   4.161629e-03
## Warning in is.na(lam): is.na() applied to non-(list or vector) of type
## 'NULL'

## Warning in is.na(lam): is.na() applied to non-(list or vector) of type
## 'NULL'

##          Prediction
## Reference   D   R
##         D  16 193
##         R   8 278
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   5.939394e-01   5.515512e-02   5.492118e-01   6.375382e-01   5.777778e-01 
## AccuracyPValue  McnemarPValue 
##   2.478775e-01   1.623204e-38 
## [1] "myfit_mdl: predict complete: 28.003000 secs"
##                        id
## 1 All.X#BoxCox#rcv#glmnet
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             feats
## 1 Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff
##   max.nTuningRuns min.elapsedtime.everything min.elapsedtime.final
## 1              25                     17.083                 1.772
##   max.AUCpROC.fit max.Sens.fit max.Spec.fit max.AUCROCR.fit
## 1       0.5838976     0.318456    0.8493392       0.6603466
##   opt.prob.threshold.fit max.f.score.fit max.Accuracy.fit
## 1                   0.55       0.6925043        0.6098108
##   max.AccuracyLower.fit max.AccuracyUpper.fit max.Kappa.fit
## 1             0.6106194             0.6537503     0.1457828
##   max.AUCpROC.OOB max.Sens.OOB max.Spec.OOB max.AUCROCR.OOB
## 1       0.5441664    0.2631579    0.8251748       0.5655804
##   opt.prob.threshold.OOB max.f.score.OOB max.Accuracy.OOB
## 1                   0.45       0.7344782        0.5939394
##   max.AccuracyLower.OOB max.AccuracyUpper.OOB max.Kappa.OOB
## 1             0.5492118             0.6375382    0.05515512
##   max.AccuracySD.fit max.KappaSD.fit
## 1         0.01567398      0.03089611
## Warning in is.na(lam): is.na() applied to non-(list or vector) of type
## 'NULL'

## [1] "myfit_mdl: exit: 28.273000 secs"
## [1] "myfit_mdl: enter: 0.000000 secs"
## [1] "myfit_mdl: fitting model: All.X#YeoJohnson#rcv#glmnet"
## [1] "    indepVar: Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff"
## [1] "myfit_mdl: setup complete: 0.664000 secs"
## Aggregating results
## Selecting tuning parameters
## Fitting alpha = 0.55, lambda = 0.0376 on full training set
## [1] "myfit_mdl: train complete: 52.015000 secs"
## Warning in myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst =
## list(id.prefix = bstMdlIdComponents$family, : model's bestTune found at an
## extreme of tuneGrid for parameter: lambda

##             Length Class      Mode     
## a0             98  -none-     numeric  
## beta        24598  dgCMatrix  S4       
## df             98  -none-     numeric  
## dim             2  -none-     numeric  
## lambda         98  -none-     numeric  
## dev.ratio      98  -none-     numeric  
## nulldev         1  -none-     numeric  
## npasses         1  -none-     numeric  
## jerr            1  -none-     numeric  
## offset          1  -none-     logical  
## classnames      2  -none-     character
## call            5  -none-     call     
## nobs            1  -none-     numeric  
## lambdaOpt       1  -none-     numeric  
## xNames        251  -none-     character
## problemType     1  -none-     character
## tuneValue       2  data.frame list     
## obsLevels       2  -none-     character
## [1] "min lambda > lambdaOpt:"
##       (Intercept)     Hhold.fctrMKy     Hhold.fctrPKn   Q101163.fctrDad 
##        0.23798411        0.01874708       -0.13442634        0.09255838 
##    Q106997.fctrGr  Q108855.fctrYes!    Q110740.fctrPC    Q113181.fctrNo 
##        0.04606394        0.05583211        0.02832168       -0.17278645 
##   Q113181.fctrYes    Q115611.fctrNo   Q115611.fctrYes Q116881.fctrRight 
##        0.08695903       -0.13399486        0.36549211        0.17630958 
##   Q122120.fctrYes   Q123621.fctrYes     Q98197.fctrNo     Q98869.fctrNo 
##        0.04163127        0.00229355       -0.14923426       -0.08488000 
##     Q99480.fctrNo 
##       -0.08339722 
## [1] "max lambda < lambdaOpt:"
##         (Intercept)       Hhold.fctrMKy       Hhold.fctrPKn 
##         0.216260115         0.027552836        -0.172608767 
##     Q101163.fctrDad     Q106388.fctrYes      Q106997.fctrGr 
##         0.104315647         0.004549068         0.066207479 
##    Q108855.fctrYes!      Q110740.fctrPC      Q113181.fctrNo 
##         0.071265356         0.042228759        -0.188579678 
##     Q113181.fctrYes      Q115611.fctrNo     Q115611.fctrYes 
##         0.078590932        -0.148973794         0.363232265 
##   Q116881.fctrRight Q120472.fctrScience     Q122120.fctrYes 
##         0.190801458         0.009230062         0.061075685 
##     Q123621.fctrYes       Q98197.fctrNo       Q98869.fctrNo 
##         0.010278853        -0.157484555        -0.099872253 
##       Q99480.fctrNo 
##        -0.095613180 
## [1] "myfit_mdl: train diagnostics complete: 52.682000 secs"

##          Prediction
## Reference   D   R
##         D 429 400
##         R 322 813
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   6.323829e-01   2.367939e-01   6.106194e-01   6.537503e-01   5.779022e-01 
## AccuracyPValue  McnemarPValue 
##   4.843674e-07   4.161629e-03

##          Prediction
## Reference   D   R
##         D  16 193
##         R   8 278
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   5.939394e-01   5.515512e-02   5.492118e-01   6.375382e-01   5.777778e-01 
## AccuracyPValue  McnemarPValue 
##   2.478775e-01   1.623204e-38 
## [1] "myfit_mdl: predict complete: 62.415000 secs"
##                            id
## 1 All.X#YeoJohnson#rcv#glmnet
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             feats
## 1 Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff
##   max.nTuningRuns min.elapsedtime.everything min.elapsedtime.final
## 1              25                     51.262                 6.788
##   max.AUCpROC.fit max.Sens.fit max.Spec.fit max.AUCROCR.fit
## 1       0.5838976     0.318456    0.8493392       0.6603466
##   opt.prob.threshold.fit max.f.score.fit max.Accuracy.fit
## 1                   0.55       0.6925043        0.6093019
##   max.AccuracyLower.fit max.AccuracyUpper.fit max.Kappa.fit
## 1             0.6106194             0.6537503     0.1445959
##   max.AUCpROC.OOB max.Sens.OOB max.Spec.OOB max.AUCROCR.OOB
## 1       0.5441664    0.2631579    0.8251748       0.5655804
##   opt.prob.threshold.OOB max.f.score.OOB max.Accuracy.OOB
## 1                   0.45       0.7344782        0.5939394
##   max.AccuracyLower.OOB max.AccuracyUpper.OOB max.Kappa.OOB
## 1             0.5492118             0.6375382    0.05515512
##   max.AccuracySD.fit max.KappaSD.fit
## 1         0.01436005      0.02840821
## [1] "myfit_mdl: exit: 62.712000 secs"
## [1] "myfit_mdl: enter: 0.000000 secs"
## [1] "myfit_mdl: fitting model: All.X#expoTrans#rcv#glmnet"
## [1] "    indepVar: Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff"
## [1] "myfit_mdl: setup complete: 0.670000 secs"
## Aggregating results
## Selecting tuning parameters
## Fitting alpha = 0.55, lambda = 0.0376 on full training set
## [1] "myfit_mdl: train complete: 53.507000 secs"
## Warning in myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst =
## list(id.prefix = bstMdlIdComponents$family, : model's bestTune found at an
## extreme of tuneGrid for parameter: lambda

##             Length Class      Mode     
## a0            100  -none-     numeric  
## beta        25100  dgCMatrix  S4       
## df            100  -none-     numeric  
## dim             2  -none-     numeric  
## lambda        100  -none-     numeric  
## dev.ratio     100  -none-     numeric  
## nulldev         1  -none-     numeric  
## npasses         1  -none-     numeric  
## jerr            1  -none-     numeric  
## offset          1  -none-     logical  
## classnames      2  -none-     character
## call            5  -none-     call     
## nobs            1  -none-     numeric  
## lambdaOpt       1  -none-     numeric  
## xNames        251  -none-     character
## problemType     1  -none-     character
## tuneValue       2  data.frame list     
## obsLevels       2  -none-     character
## [1] "min lambda > lambdaOpt:"
##       (Intercept)     Hhold.fctrMKy     Hhold.fctrPKn   Q101163.fctrDad 
##        0.23798411        0.01874708       -0.13442634        0.09255838 
##    Q106997.fctrGr  Q108855.fctrYes!    Q110740.fctrPC    Q113181.fctrNo 
##        0.04606394        0.05583211        0.02832168       -0.17278645 
##   Q113181.fctrYes    Q115611.fctrNo   Q115611.fctrYes Q116881.fctrRight 
##        0.08695903       -0.13399486        0.36549211        0.17630958 
##   Q122120.fctrYes   Q123621.fctrYes     Q98197.fctrNo     Q98869.fctrNo 
##        0.04163127        0.00229355       -0.14923426       -0.08488000 
##     Q99480.fctrNo 
##       -0.08339722 
## [1] "max lambda < lambdaOpt:"
##         (Intercept)       Hhold.fctrMKy       Hhold.fctrPKn 
##         0.216260115         0.027552836        -0.172608767 
##     Q101163.fctrDad     Q106388.fctrYes      Q106997.fctrGr 
##         0.104315647         0.004549068         0.066207479 
##    Q108855.fctrYes!      Q110740.fctrPC      Q113181.fctrNo 
##         0.071265356         0.042228759        -0.188579678 
##     Q113181.fctrYes      Q115611.fctrNo     Q115611.fctrYes 
##         0.078590932        -0.148973794         0.363232265 
##   Q116881.fctrRight Q120472.fctrScience     Q122120.fctrYes 
##         0.190801458         0.009230062         0.061075685 
##     Q123621.fctrYes       Q98197.fctrNo       Q98869.fctrNo 
##         0.010278853        -0.157484555        -0.099872253 
##       Q99480.fctrNo 
##        -0.095613180 
## [1] "myfit_mdl: train diagnostics complete: 54.167000 secs"

##          Prediction
## Reference   D   R
##         D 429 400
##         R 322 813
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   6.323829e-01   2.367939e-01   6.106194e-01   6.537503e-01   5.779022e-01 
## AccuracyPValue  McnemarPValue 
##   4.843674e-07   4.161629e-03

##          Prediction
## Reference   D   R
##         D  16 193
##         R   8 278
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   5.939394e-01   5.515512e-02   5.492118e-01   6.375382e-01   5.777778e-01 
## AccuracyPValue  McnemarPValue 
##   2.478775e-01   1.623204e-38 
## [1] "myfit_mdl: predict complete: 63.449000 secs"
##                           id
## 1 All.X#expoTrans#rcv#glmnet
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             feats
## 1 Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff
##   max.nTuningRuns min.elapsedtime.everything min.elapsedtime.final
## 1              25                     52.761                 6.716
##   max.AUCpROC.fit max.Sens.fit max.Spec.fit max.AUCROCR.fit
## 1       0.5838976     0.318456    0.8493392       0.6603466
##   opt.prob.threshold.fit max.f.score.fit max.Accuracy.fit
## 1                   0.55       0.6925043        0.6089627
##   max.AccuracyLower.fit max.AccuracyUpper.fit max.Kappa.fit
## 1             0.6106194             0.6537503     0.1438465
##   max.AUCpROC.OOB max.Sens.OOB max.Spec.OOB max.AUCROCR.OOB
## 1       0.5441664    0.2631579    0.8251748       0.5655804
##   opt.prob.threshold.OOB max.f.score.OOB max.Accuracy.OOB
## 1                   0.45       0.7344782        0.5939394
##   max.AccuracyLower.OOB max.AccuracyUpper.OOB max.Kappa.OOB
## 1             0.5492118             0.6375382    0.05515512
##   max.AccuracySD.fit max.KappaSD.fit
## 1         0.01450064      0.02901614
## [1] "myfit_mdl: exit: 63.782000 secs"
## [1] "myfit_mdl: enter: 0.001000 secs"
## [1] "myfit_mdl: fitting model: All.X#center#rcv#glmnet"
## [1] "    indepVar: Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff"
## [1] "myfit_mdl: setup complete: 0.679000 secs"
## Aggregating results
## Selecting tuning parameters
## Fitting alpha = 0.55, lambda = 0.0376 on full training set
## [1] "myfit_mdl: train complete: 15.769000 secs"
## Warning in myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst =
## list(id.prefix = bstMdlIdComponents$family, : model's bestTune found at an
## extreme of tuneGrid for parameter: lambda

##             Length Class      Mode     
## a0             82  -none-     numeric  
## beta        20582  dgCMatrix  S4       
## df             82  -none-     numeric  
## dim             2  -none-     numeric  
## lambda         82  -none-     numeric  
## dev.ratio      82  -none-     numeric  
## nulldev         1  -none-     numeric  
## npasses         1  -none-     numeric  
## jerr            1  -none-     numeric  
## offset          1  -none-     logical  
## classnames      2  -none-     character
## call            5  -none-     call     
## nobs            1  -none-     numeric  
## lambdaOpt       1  -none-     numeric  
## xNames        251  -none-     character
## problemType     1  -none-     character
## tuneValue       2  data.frame list     
## obsLevels       2  -none-     character
## [1] "min lambda > lambdaOpt:"
##       (Intercept)     Hhold.fctrMKy     Hhold.fctrPKn   Q101163.fctrDad 
##        0.32427436        0.01874708       -0.13442634        0.09255838 
##    Q106997.fctrGr  Q108855.fctrYes!    Q110740.fctrPC    Q113181.fctrNo 
##        0.04606394        0.05583211        0.02832168       -0.17278645 
##   Q113181.fctrYes    Q115611.fctrNo   Q115611.fctrYes Q116881.fctrRight 
##        0.08695903       -0.13399486        0.36549211        0.17630958 
##   Q122120.fctrYes   Q123621.fctrYes     Q98197.fctrNo     Q98869.fctrNo 
##        0.04163127        0.00229355       -0.14923426       -0.08488000 
##     Q99480.fctrNo 
##       -0.08339722 
## [1] "max lambda < lambdaOpt:"
##         (Intercept)       Hhold.fctrMKy       Hhold.fctrPKn 
##         0.325377824         0.027552836        -0.172608767 
##     Q101163.fctrDad     Q106388.fctrYes      Q106997.fctrGr 
##         0.104315647         0.004549068         0.066207479 
##    Q108855.fctrYes!      Q110740.fctrPC      Q113181.fctrNo 
##         0.071265356         0.042228759        -0.188579678 
##     Q113181.fctrYes      Q115611.fctrNo     Q115611.fctrYes 
##         0.078590932        -0.148973794         0.363232265 
##   Q116881.fctrRight Q120472.fctrScience     Q122120.fctrYes 
##         0.190801458         0.009230062         0.061075685 
##     Q123621.fctrYes       Q98197.fctrNo       Q98869.fctrNo 
##         0.010278853        -0.157484555        -0.099872253 
##       Q99480.fctrNo 
##        -0.095613180 
## [1] "myfit_mdl: train diagnostics complete: 16.404000 secs"

##          Prediction
## Reference   D   R
##         D 429 400
##         R 322 813
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   6.323829e-01   2.367939e-01   6.106194e-01   6.537503e-01   5.779022e-01 
## AccuracyPValue  McnemarPValue 
##   4.843674e-07   4.161629e-03

##          Prediction
## Reference   D   R
##         D  16 193
##         R   8 278
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   5.939394e-01   5.515512e-02   5.492118e-01   6.375382e-01   5.777778e-01 
## AccuracyPValue  McnemarPValue 
##   2.478775e-01   1.623204e-38 
## [1] "myfit_mdl: predict complete: 25.573000 secs"
##                        id
## 1 All.X#center#rcv#glmnet
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             feats
## 1 Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff
##   max.nTuningRuns min.elapsedtime.everything min.elapsedtime.final
## 1              25                     15.011                 1.427
##   max.AUCpROC.fit max.Sens.fit max.Spec.fit max.AUCROCR.fit
## 1       0.5838976     0.318456    0.8493392       0.6603466
##   opt.prob.threshold.fit max.f.score.fit max.Accuracy.fit
## 1                   0.55       0.6925043        0.6098108
##   max.AccuracyLower.fit max.AccuracyUpper.fit max.Kappa.fit
## 1             0.6106194             0.6537503     0.1457828
##   max.AUCpROC.OOB max.Sens.OOB max.Spec.OOB max.AUCROCR.OOB
## 1       0.5441664    0.2631579    0.8251748       0.5655804
##   opt.prob.threshold.OOB max.f.score.OOB max.Accuracy.OOB
## 1                   0.45       0.7344782        0.5939394
##   max.AccuracyLower.OOB max.AccuracyUpper.OOB max.Kappa.OOB
## 1             0.5492118             0.6375382    0.05515512
##   max.AccuracySD.fit max.KappaSD.fit
## 1         0.01567398      0.03089611
## [1] "myfit_mdl: exit: 25.899000 secs"
## [1] "myfit_mdl: enter: 0.001000 secs"
## [1] "myfit_mdl: fitting model: All.X#scale#rcv#glmnet"
## [1] "    indepVar: Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff"
## [1] "myfit_mdl: setup complete: 0.687000 secs"
## Warning in preProcess.default(method = "scale", x =
## structure(c(-0.480112420809766, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## Aggregating results
## Selecting tuning parameters
## Fitting alpha = 0.55, lambda = 0.0376 on full training set
## Warning in preProcess.default(thresh = 0.95, k = 5, method = "scale", x
## = structure(c(-0.480112420809766, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff

## [1] "myfit_mdl: train complete: 15.804000 secs"
## Warning in myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst =
## list(id.prefix = bstMdlIdComponents$family, : model's bestTune found at an
## extreme of tuneGrid for parameter: lambda

##             Length Class      Mode     
## a0             82  -none-     numeric  
## beta        20582  dgCMatrix  S4       
## df             82  -none-     numeric  
## dim             2  -none-     numeric  
## lambda         82  -none-     numeric  
## dev.ratio      82  -none-     numeric  
## nulldev         1  -none-     numeric  
## npasses         1  -none-     numeric  
## jerr            1  -none-     numeric  
## offset          1  -none-     logical  
## classnames      2  -none-     character
## call            5  -none-     call     
## nobs            1  -none-     numeric  
## lambdaOpt       1  -none-     numeric  
## xNames        251  -none-     character
## problemType     1  -none-     character
## tuneValue       2  data.frame list     
## obsLevels       2  -none-     character
## [1] "min lambda > lambdaOpt:"
##       (Intercept)     Hhold.fctrMKy     Hhold.fctrPKn   Q101163.fctrDad 
##       0.237984114       0.008912228      -0.020762127       0.046273476 
##    Q106997.fctrGr  Q108855.fctrYes!    Q110740.fctrPC    Q113181.fctrNo 
##       0.022991875       0.027905424       0.014138859      -0.086176124 
##   Q113181.fctrYes    Q115611.fctrNo   Q115611.fctrYes Q116881.fctrRight 
##       0.042435423      -0.067012792       0.174754639       0.076155233 
##   Q122120.fctrYes   Q123621.fctrYes     Q98197.fctrNo     Q98869.fctrNo 
##       0.016832232       0.001126528      -0.074491997      -0.031155883 
##     Q99480.fctrNo 
##      -0.030845513 
## [1] "max lambda < lambdaOpt:"
##         (Intercept)       Hhold.fctrMKy       Hhold.fctrPKn 
##         0.216260115         0.013098424        -0.026659397 
##     Q101163.fctrDad     Q106388.fctrYes      Q106997.fctrGr 
##         0.052151384         0.001939986         0.033046109 
##    Q108855.fctrYes!      Q110740.fctrPC      Q113181.fctrNo 
##         0.035619108         0.021081604        -0.094052895 
##     Q113181.fctrYes      Q115611.fctrNo     Q115611.fctrYes 
##         0.038351849        -0.074503974         0.173674126 
##   Q116881.fctrRight Q120472.fctrScience     Q122120.fctrYes 
##         0.082414860         0.004553742         0.024693943 
##     Q123621.fctrYes       Q98197.fctrNo       Q98869.fctrNo 
##         0.005048686        -0.078610226        -0.036658911 
##       Q99480.fctrNo 
##        -0.035363738 
## [1] "myfit_mdl: train diagnostics complete: 16.456000 secs"

##          Prediction
## Reference   D   R
##         D 429 400
##         R 322 813
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   6.323829e-01   2.367939e-01   6.106194e-01   6.537503e-01   5.779022e-01 
## AccuracyPValue  McnemarPValue 
##   4.843674e-07   4.161629e-03

##          Prediction
## Reference   D   R
##         D  16 193
##         R   8 278
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   5.939394e-01   5.515512e-02   5.492118e-01   6.375382e-01   5.777778e-01 
## AccuracyPValue  McnemarPValue 
##   2.478775e-01   1.623204e-38 
## [1] "myfit_mdl: predict complete: 25.637000 secs"
##                       id
## 1 All.X#scale#rcv#glmnet
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             feats
## 1 Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff
##   max.nTuningRuns min.elapsedtime.everything min.elapsedtime.final
## 1              25                     15.038                 1.424
##   max.AUCpROC.fit max.Sens.fit max.Spec.fit max.AUCROCR.fit
## 1       0.5838976     0.318456    0.8493392       0.6603466
##   opt.prob.threshold.fit max.f.score.fit max.Accuracy.fit
## 1                   0.55       0.6925043        0.6098108
##   max.AccuracyLower.fit max.AccuracyUpper.fit max.Kappa.fit
## 1             0.6106194             0.6537503     0.1457828
##   max.AUCpROC.OOB max.Sens.OOB max.Spec.OOB max.AUCROCR.OOB
## 1       0.5441664    0.2631579    0.8251748       0.5655804
##   opt.prob.threshold.OOB max.f.score.OOB max.Accuracy.OOB
## 1                   0.45       0.7344782        0.5939394
##   max.AccuracyLower.OOB max.AccuracyUpper.OOB max.Kappa.OOB
## 1             0.5492118             0.6375382    0.05515512
##   max.AccuracySD.fit max.KappaSD.fit
## 1         0.01567398      0.03089611
## [1] "myfit_mdl: exit: 25.958000 secs"
## [1] "myfit_mdl: enter: 0.000000 secs"
## [1] "myfit_mdl: fitting model: All.X#center.scale#rcv#glmnet"
## [1] "    indepVar: Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff"
## [1] "myfit_mdl: setup complete: 0.666000 secs"
## Warning in preProcess.default(method = c("center", "scale"), x =
## structure(c(-0.480112420809766, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## Aggregating results
## Selecting tuning parameters
## Fitting alpha = 0.55, lambda = 0.0376 on full training set
## Warning in preProcess.default(thresh = 0.95, k = 5, method = c("center", :
## These variables have zero variances: Q115611.fctrNo:.clusterid.fctr4,
## Q115611.fctrYes:.clusterid.fctr4, Q115611.fctrNo:.clusterid.fctr5,
## Q115611.fctrYes:.clusterid.fctr5, YOB.Age.fctrNA:YOB.Age.dff

## [1] "myfit_mdl: train complete: 16.549000 secs"
## Warning in myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst =
## list(id.prefix = bstMdlIdComponents$family, : model's bestTune found at an
## extreme of tuneGrid for parameter: lambda

##             Length Class      Mode     
## a0             82  -none-     numeric  
## beta        20582  dgCMatrix  S4       
## df             82  -none-     numeric  
## dim             2  -none-     numeric  
## lambda         82  -none-     numeric  
## dev.ratio      82  -none-     numeric  
## nulldev         1  -none-     numeric  
## npasses         1  -none-     numeric  
## jerr            1  -none-     numeric  
## offset          1  -none-     logical  
## classnames      2  -none-     character
## call            5  -none-     call     
## nobs            1  -none-     numeric  
## lambdaOpt       1  -none-     numeric  
## xNames        251  -none-     character
## problemType     1  -none-     character
## tuneValue       2  data.frame list     
## obsLevels       2  -none-     character
## [1] "min lambda > lambdaOpt:"
##       (Intercept)     Hhold.fctrMKy     Hhold.fctrPKn   Q101163.fctrDad 
##       0.324274358       0.008912228      -0.020762127       0.046273476 
##    Q106997.fctrGr  Q108855.fctrYes!    Q110740.fctrPC    Q113181.fctrNo 
##       0.022991875       0.027905424       0.014138859      -0.086176124 
##   Q113181.fctrYes    Q115611.fctrNo   Q115611.fctrYes Q116881.fctrRight 
##       0.042435423      -0.067012792       0.174754639       0.076155233 
##   Q122120.fctrYes   Q123621.fctrYes     Q98197.fctrNo     Q98869.fctrNo 
##       0.016832232       0.001126528      -0.074491997      -0.031155883 
##     Q99480.fctrNo 
##      -0.030845513 
## [1] "max lambda < lambdaOpt:"
##         (Intercept)       Hhold.fctrMKy       Hhold.fctrPKn 
##         0.325377824         0.013098424        -0.026659397 
##     Q101163.fctrDad     Q106388.fctrYes      Q106997.fctrGr 
##         0.052151384         0.001939986         0.033046109 
##    Q108855.fctrYes!      Q110740.fctrPC      Q113181.fctrNo 
##         0.035619108         0.021081604        -0.094052895 
##     Q113181.fctrYes      Q115611.fctrNo     Q115611.fctrYes 
##         0.038351849        -0.074503974         0.173674126 
##   Q116881.fctrRight Q120472.fctrScience     Q122120.fctrYes 
##         0.082414860         0.004553742         0.024693943 
##     Q123621.fctrYes       Q98197.fctrNo       Q98869.fctrNo 
##         0.005048686        -0.078610226        -0.036658911 
##       Q99480.fctrNo 
##        -0.035363738 
## [1] "myfit_mdl: train diagnostics complete: 17.193000 secs"

##          Prediction
## Reference   D   R
##         D 429 400
##         R 322 813
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   6.323829e-01   2.367939e-01   6.106194e-01   6.537503e-01   5.779022e-01 
## AccuracyPValue  McnemarPValue 
##   4.843674e-07   4.161629e-03

##          Prediction
## Reference   D   R
##         D  16 193
##         R   8 278
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   5.939394e-01   5.515512e-02   5.492118e-01   6.375382e-01   5.777778e-01 
## AccuracyPValue  McnemarPValue 
##   2.478775e-01   1.623204e-38 
## [1] "myfit_mdl: predict complete: 26.477000 secs"
##                              id
## 1 All.X#center.scale#rcv#glmnet
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             feats
## 1 Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff
##   max.nTuningRuns min.elapsedtime.everything min.elapsedtime.final
## 1              25                     15.805                 1.565
##   max.AUCpROC.fit max.Sens.fit max.Spec.fit max.AUCROCR.fit
## 1       0.5838976     0.318456    0.8493392       0.6603466
##   opt.prob.threshold.fit max.f.score.fit max.Accuracy.fit
## 1                   0.55       0.6925043        0.6098108
##   max.AccuracyLower.fit max.AccuracyUpper.fit max.Kappa.fit
## 1             0.6106194             0.6537503     0.1457828
##   max.AUCpROC.OOB max.Sens.OOB max.Spec.OOB max.AUCROCR.OOB
## 1       0.5441664    0.2631579    0.8251748       0.5655804
##   opt.prob.threshold.OOB max.f.score.OOB max.Accuracy.OOB
## 1                   0.45       0.7344782        0.5939394
##   max.AccuracyLower.OOB max.AccuracyUpper.OOB max.Kappa.OOB
## 1             0.5492118             0.6375382    0.05515512
##   max.AccuracySD.fit max.KappaSD.fit
## 1         0.01567398      0.03089611
## [1] "myfit_mdl: exit: 26.848000 secs"
## [1] "myfit_mdl: enter: 0.000000 secs"
## [1] "myfit_mdl: fitting model: All.X#range#rcv#glmnet"
## [1] "    indepVar: Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff"
## [1] "myfit_mdl: setup complete: 0.668000 secs"
## Warning in preProcess.default(method = "range", x =
## structure(c(-0.480112420809766, : No variation for for:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## Aggregating results
## Selecting tuning parameters
## Fitting alpha = 0.55, lambda = 0.0376 on full training set
## Warning in preProcess.default(thresh = 0.95, k = 5, method =
## "range", x = structure(c(-0.480112420809766, : No variation for for:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff

## [1] "myfit_mdl: train complete: 17.109000 secs"
## Warning in myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst =
## list(id.prefix = bstMdlIdComponents$family, : model's bestTune found at an
## extreme of tuneGrid for parameter: lambda

##             Length Class      Mode     
## a0             82  -none-     numeric  
## beta        20582  dgCMatrix  S4       
## df             82  -none-     numeric  
## dim             2  -none-     numeric  
## lambda         82  -none-     numeric  
## dev.ratio      82  -none-     numeric  
## nulldev         1  -none-     numeric  
## npasses         1  -none-     numeric  
## jerr            1  -none-     numeric  
## offset          1  -none-     logical  
## classnames      2  -none-     character
## call            5  -none-     call     
## nobs            1  -none-     numeric  
## lambdaOpt       1  -none-     numeric  
## xNames        251  -none-     character
## problemType     1  -none-     character
## tuneValue       2  data.frame list     
## obsLevels       2  -none-     character
## [1] "min lambda > lambdaOpt:"
##       (Intercept)     Hhold.fctrMKy     Hhold.fctrPKn   Q101163.fctrDad 
##        0.23798411        0.01874708       -0.13442634        0.09255838 
##    Q106997.fctrGr  Q108855.fctrYes!    Q110740.fctrPC    Q113181.fctrNo 
##        0.04606394        0.05583211        0.02832168       -0.17278645 
##   Q113181.fctrYes    Q115611.fctrNo   Q115611.fctrYes Q116881.fctrRight 
##        0.08695903       -0.13399486        0.36549211        0.17630958 
##   Q122120.fctrYes   Q123621.fctrYes     Q98197.fctrNo     Q98869.fctrNo 
##        0.04163127        0.00229355       -0.14923426       -0.08488000 
##     Q99480.fctrNo 
##       -0.08339722 
## [1] "max lambda < lambdaOpt:"
##         (Intercept)       Hhold.fctrMKy       Hhold.fctrPKn 
##         0.216260115         0.027552836        -0.172608767 
##     Q101163.fctrDad     Q106388.fctrYes      Q106997.fctrGr 
##         0.104315647         0.004549068         0.066207479 
##    Q108855.fctrYes!      Q110740.fctrPC      Q113181.fctrNo 
##         0.071265356         0.042228759        -0.188579678 
##     Q113181.fctrYes      Q115611.fctrNo     Q115611.fctrYes 
##         0.078590932        -0.148973794         0.363232265 
##   Q116881.fctrRight Q120472.fctrScience     Q122120.fctrYes 
##         0.190801458         0.009230062         0.061075685 
##     Q123621.fctrYes       Q98197.fctrNo       Q98869.fctrNo 
##         0.010278853        -0.157484555        -0.099872253 
##       Q99480.fctrNo 
##        -0.095613180 
## [1] "myfit_mdl: train diagnostics complete: 17.743000 secs"

##          Prediction
## Reference   D   R
##         D 429 400
##         R 322 813
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   6.323829e-01   2.367939e-01   6.106194e-01   6.537503e-01   5.779022e-01 
## AccuracyPValue  McnemarPValue 
##   4.843674e-07   4.161629e-03

##          Prediction
## Reference   D   R
##         D  16 193
##         R   8 278
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   5.939394e-01   5.515512e-02   5.492118e-01   6.375382e-01   5.777778e-01 
## AccuracyPValue  McnemarPValue 
##   2.478775e-01   1.623204e-38 
## [1] "myfit_mdl: predict complete: 27.399000 secs"
##                       id
## 1 All.X#range#rcv#glmnet
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             feats
## 1 Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff
##   max.nTuningRuns min.elapsedtime.everything min.elapsedtime.final
## 1              25                     16.349                 1.491
##   max.AUCpROC.fit max.Sens.fit max.Spec.fit max.AUCROCR.fit
## 1       0.5838976     0.318456    0.8493392       0.6603466
##   opt.prob.threshold.fit max.f.score.fit max.Accuracy.fit
## 1                   0.55       0.6925043        0.6098108
##   max.AccuracyLower.fit max.AccuracyUpper.fit max.Kappa.fit
## 1             0.6106194             0.6537503     0.1457828
##   max.AUCpROC.OOB max.Sens.OOB max.Spec.OOB max.AUCROCR.OOB
## 1       0.5441664    0.2631579    0.8251748       0.5655804
##   opt.prob.threshold.OOB max.f.score.OOB max.Accuracy.OOB
## 1                   0.45       0.7344782        0.5939394
##   max.AccuracyLower.OOB max.AccuracyUpper.OOB max.Kappa.OOB
## 1             0.5492118             0.6375382    0.05515512
##   max.AccuracySD.fit max.KappaSD.fit
## 1         0.01567398      0.03089611
## [1] "myfit_mdl: exit: 27.778000 secs"
## [1] "myfit_mdl: enter: 0.001000 secs"
## [1] "myfit_mdl: fitting model: All.X#zv.pca#rcv#glmnet"
## [1] "    indepVar: Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff"
## [1] "myfit_mdl: setup complete: 0.672000 secs"
## + Fold1.Rep1: alpha=0.100, lambda=0.04607 
## - Fold1.Rep1: alpha=0.100, lambda=0.04607 
## + Fold1.Rep1: alpha=0.325, lambda=0.04607 
## - Fold1.Rep1: alpha=0.325, lambda=0.04607 
## + Fold1.Rep1: alpha=0.550, lambda=0.04607 
## - Fold1.Rep1: alpha=0.550, lambda=0.04607 
## + Fold1.Rep1: alpha=0.775, lambda=0.04607 
## - Fold1.Rep1: alpha=0.775, lambda=0.04607 
## + Fold1.Rep1: alpha=1.000, lambda=0.04607 
## - Fold1.Rep1: alpha=1.000, lambda=0.04607 
## + Fold2.Rep1: alpha=0.100, lambda=0.04607 
## - Fold2.Rep1: alpha=0.100, lambda=0.04607 
## + Fold2.Rep1: alpha=0.325, lambda=0.04607 
## - Fold2.Rep1: alpha=0.325, lambda=0.04607 
## + Fold2.Rep1: alpha=0.550, lambda=0.04607 
## - Fold2.Rep1: alpha=0.550, lambda=0.04607 
## + Fold2.Rep1: alpha=0.775, lambda=0.04607 
## - Fold2.Rep1: alpha=0.775, lambda=0.04607 
## + Fold2.Rep1: alpha=1.000, lambda=0.04607 
## - Fold2.Rep1: alpha=1.000, lambda=0.04607 
## + Fold3.Rep1: alpha=0.100, lambda=0.04607 
## - Fold3.Rep1: alpha=0.100, lambda=0.04607 
## + Fold3.Rep1: alpha=0.325, lambda=0.04607 
## - Fold3.Rep1: alpha=0.325, lambda=0.04607 
## + Fold3.Rep1: alpha=0.550, lambda=0.04607 
## - Fold3.Rep1: alpha=0.550, lambda=0.04607 
## + Fold3.Rep1: alpha=0.775, lambda=0.04607 
## - Fold3.Rep1: alpha=0.775, lambda=0.04607 
## + Fold3.Rep1: alpha=1.000, lambda=0.04607 
## - Fold3.Rep1: alpha=1.000, lambda=0.04607 
## + Fold1.Rep2: alpha=0.100, lambda=0.04607 
## - Fold1.Rep2: alpha=0.100, lambda=0.04607 
## + Fold1.Rep2: alpha=0.325, lambda=0.04607 
## - Fold1.Rep2: alpha=0.325, lambda=0.04607 
## + Fold1.Rep2: alpha=0.550, lambda=0.04607 
## - Fold1.Rep2: alpha=0.550, lambda=0.04607 
## + Fold1.Rep2: alpha=0.775, lambda=0.04607 
## - Fold1.Rep2: alpha=0.775, lambda=0.04607 
## + Fold1.Rep2: alpha=1.000, lambda=0.04607 
## - Fold1.Rep2: alpha=1.000, lambda=0.04607 
## + Fold2.Rep2: alpha=0.100, lambda=0.04607 
## - Fold2.Rep2: alpha=0.100, lambda=0.04607 
## + Fold2.Rep2: alpha=0.325, lambda=0.04607 
## - Fold2.Rep2: alpha=0.325, lambda=0.04607 
## + Fold2.Rep2: alpha=0.550, lambda=0.04607 
## - Fold2.Rep2: alpha=0.550, lambda=0.04607 
## + Fold2.Rep2: alpha=0.775, lambda=0.04607 
## - Fold2.Rep2: alpha=0.775, lambda=0.04607 
## + Fold2.Rep2: alpha=1.000, lambda=0.04607 
## - Fold2.Rep2: alpha=1.000, lambda=0.04607 
## + Fold3.Rep2: alpha=0.100, lambda=0.04607 
## - Fold3.Rep2: alpha=0.100, lambda=0.04607 
## + Fold3.Rep2: alpha=0.325, lambda=0.04607 
## - Fold3.Rep2: alpha=0.325, lambda=0.04607 
## + Fold3.Rep2: alpha=0.550, lambda=0.04607 
## - Fold3.Rep2: alpha=0.550, lambda=0.04607 
## + Fold3.Rep2: alpha=0.775, lambda=0.04607 
## - Fold3.Rep2: alpha=0.775, lambda=0.04607 
## + Fold3.Rep2: alpha=1.000, lambda=0.04607 
## - Fold3.Rep2: alpha=1.000, lambda=0.04607 
## + Fold1.Rep3: alpha=0.100, lambda=0.04607 
## - Fold1.Rep3: alpha=0.100, lambda=0.04607 
## + Fold1.Rep3: alpha=0.325, lambda=0.04607 
## - Fold1.Rep3: alpha=0.325, lambda=0.04607 
## + Fold1.Rep3: alpha=0.550, lambda=0.04607 
## - Fold1.Rep3: alpha=0.550, lambda=0.04607 
## + Fold1.Rep3: alpha=0.775, lambda=0.04607 
## - Fold1.Rep3: alpha=0.775, lambda=0.04607 
## + Fold1.Rep3: alpha=1.000, lambda=0.04607 
## - Fold1.Rep3: alpha=1.000, lambda=0.04607 
## + Fold2.Rep3: alpha=0.100, lambda=0.04607 
## - Fold2.Rep3: alpha=0.100, lambda=0.04607 
## + Fold2.Rep3: alpha=0.325, lambda=0.04607 
## - Fold2.Rep3: alpha=0.325, lambda=0.04607 
## + Fold2.Rep3: alpha=0.550, lambda=0.04607 
## - Fold2.Rep3: alpha=0.550, lambda=0.04607 
## + Fold2.Rep3: alpha=0.775, lambda=0.04607 
## - Fold2.Rep3: alpha=0.775, lambda=0.04607 
## + Fold2.Rep3: alpha=1.000, lambda=0.04607 
## - Fold2.Rep3: alpha=1.000, lambda=0.04607 
## + Fold3.Rep3: alpha=0.100, lambda=0.04607 
## - Fold3.Rep3: alpha=0.100, lambda=0.04607 
## + Fold3.Rep3: alpha=0.325, lambda=0.04607 
## - Fold3.Rep3: alpha=0.325, lambda=0.04607 
## + Fold3.Rep3: alpha=0.550, lambda=0.04607 
## - Fold3.Rep3: alpha=0.550, lambda=0.04607 
## + Fold3.Rep3: alpha=0.775, lambda=0.04607 
## - Fold3.Rep3: alpha=0.775, lambda=0.04607 
## + Fold3.Rep3: alpha=1.000, lambda=0.04607 
## - Fold3.Rep3: alpha=1.000, lambda=0.04607 
## Aggregating results
## Selecting tuning parameters
## Fitting alpha = 0.55, lambda = 0.03 on full training set
## [1] "myfit_mdl: train complete: 37.574000 secs"

##             Length Class      Mode     
## a0            59   -none-     numeric  
## beta        8201   dgCMatrix  S4       
## df            59   -none-     numeric  
## dim            2   -none-     numeric  
## lambda        59   -none-     numeric  
## dev.ratio     59   -none-     numeric  
## nulldev        1   -none-     numeric  
## npasses        1   -none-     numeric  
## jerr           1   -none-     numeric  
## offset         1   -none-     logical  
## classnames     2   -none-     character
## call           5   -none-     call     
## nobs           1   -none-     numeric  
## lambdaOpt      1   -none-     numeric  
## xNames       139   -none-     character
## problemType    1   -none-     character
## tuneValue      2   data.frame list     
## obsLevels      2   -none-     character
## [1] "min lambda > lambdaOpt:"
##  (Intercept)          PC1          PC2          PC3          PC5 
##  0.320962889  0.000508388 -0.024422219 -0.043633777  0.012116599 
##          PC6          PC7          PC9         PC13         PC14 
##  0.004583478 -0.086228900 -0.049270700  0.063728483 -0.054045306 
##         PC17         PC24         PC25         PC26         PC28 
##  0.013184267 -0.009824787 -0.001993748 -0.001196895 -0.002836108 
##         PC41         PC43         PC68         PC94        PC106 
##  0.023702067  0.024099830  0.054511033 -0.013807616  0.028552423 
##        PC113        PC119        PC120        PC121 
## -0.027906941 -0.025632444  0.003471869 -0.042191527 
## [1] "max lambda < lambdaOpt:"
##   (Intercept)           PC1           PC2           PC3           PC4 
##  0.3221984020  0.0022053824 -0.0266674841 -0.0463798217 -0.0027091039 
##           PC5           PC6           PC7           PC9          PC13 
##  0.0150981908  0.0077876908 -0.0902985958 -0.0531059128  0.0683404754 
##          PC14          PC17          PC24          PC25          PC26 
## -0.0584928023  0.0173872940 -0.0142954364 -0.0064086157 -0.0056908561 
##          PC28          PC34          PC41          PC43          PC63 
## -0.0073801819  0.0032980445  0.0286676924  0.0291004768  0.0024794113 
##          PC68          PC80          PC82          PC94         PC106 
##  0.0603668739 -0.0006394048  0.0004690230 -0.0199222660  0.0352566133 
##         PC113         PC119         PC120         PC121         PC133 
## -0.0349624041 -0.0328150993  0.0106274496 -0.0496255779 -0.0069385262 
## [1] "myfit_mdl: train diagnostics complete: 38.199000 secs"

##          Prediction
## Reference   D   R
##         D 416 413
##         R 305 830
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   6.344196e-01   2.372535e-01   6.126780e-01   6.557590e-01   5.779022e-01 
## AccuracyPValue  McnemarPValue 
##   1.853398e-07   6.518629e-05

##          Prediction
## Reference   D   R
##         D  41 168
##         R  29 257
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   6.020202e-01   1.040930e-01   5.573855e-01   6.454288e-01   5.777778e-01 
## AccuracyPValue  McnemarPValue 
##   1.476045e-01   8.189877e-23 
## [1] "myfit_mdl: predict complete: 47.752000 secs"
##                        id
## 1 All.X#zv.pca#rcv#glmnet
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             feats
## 1 Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff
##   max.nTuningRuns min.elapsedtime.everything min.elapsedtime.final
## 1              25                     36.825                 0.839
##   max.AUCpROC.fit max.Sens.fit max.Spec.fit max.AUCROCR.fit
## 1       0.5751375    0.2436671    0.9066079       0.6629154
##   opt.prob.threshold.fit max.f.score.fit max.Accuracy.fit
## 1                   0.55       0.6980656        0.5930076
##   max.AccuracyLower.fit max.AccuracyUpper.fit max.Kappa.fit
## 1              0.612678              0.655759    0.09455366
##   max.AUCpROC.OOB max.Sens.OOB max.Spec.OOB max.AUCROCR.OOB
## 1       0.5473868    0.1961722    0.8986014       0.6000268
##   opt.prob.threshold.OOB max.f.score.OOB max.Accuracy.OOB
## 1                    0.5       0.7229255        0.6020202
##   max.AccuracyLower.OOB max.AccuracyUpper.OOB max.Kappa.OOB
## 1             0.5573855             0.6454288      0.104093
##   max.AccuracySD.fit max.KappaSD.fit
## 1         0.01145211      0.02385109
## [1] "myfit_mdl: exit: 48.256000 secs"
## [1] "myfit_mdl: enter: 0.000000 secs"
## [1] "myfit_mdl: fitting model: All.X#ica#rcv#glmnet"
## [1] "    indepVar: Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff"
## Warning in myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst
## = list(id.prefix = bstMdlIdComponents$family, : myfit_mdl: preProcess
## method: range currently does not work for columns with no variance:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## [1] "myfit_mdl: setup complete: 0.788000 secs"
## Warning in preProcess.default(method = "ica", n.comp = 3, x =
## structure(c(-0.480112420809766, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## + Fold1.Rep1: alpha=0.100, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold1.Rep1: alpha=0.100, lambda=0.0209 
## + Fold1.Rep1: alpha=0.325, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold1.Rep1: alpha=0.325, lambda=0.0209 
## + Fold1.Rep1: alpha=0.550, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold1.Rep1: alpha=0.550, lambda=0.0209 
## + Fold1.Rep1: alpha=0.775, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold1.Rep1: alpha=0.775, lambda=0.0209 
## + Fold1.Rep1: alpha=1.000, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold1.Rep1: alpha=1.000, lambda=0.0209 
## + Fold2.Rep1: alpha=0.100, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold2.Rep1: alpha=0.100, lambda=0.0209 
## + Fold2.Rep1: alpha=0.325, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold2.Rep1: alpha=0.325, lambda=0.0209 
## + Fold2.Rep1: alpha=0.550, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold2.Rep1: alpha=0.550, lambda=0.0209 
## + Fold2.Rep1: alpha=0.775, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold2.Rep1: alpha=0.775, lambda=0.0209 
## + Fold2.Rep1: alpha=1.000, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold2.Rep1: alpha=1.000, lambda=0.0209 
## + Fold3.Rep1: alpha=0.100, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold3.Rep1: alpha=0.100, lambda=0.0209 
## + Fold3.Rep1: alpha=0.325, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold3.Rep1: alpha=0.325, lambda=0.0209 
## + Fold3.Rep1: alpha=0.550, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold3.Rep1: alpha=0.550, lambda=0.0209 
## + Fold3.Rep1: alpha=0.775, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold3.Rep1: alpha=0.775, lambda=0.0209 
## + Fold3.Rep1: alpha=1.000, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold3.Rep1: alpha=1.000, lambda=0.0209 
## + Fold1.Rep2: alpha=0.100, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold1.Rep2: alpha=0.100, lambda=0.0209 
## + Fold1.Rep2: alpha=0.325, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold1.Rep2: alpha=0.325, lambda=0.0209 
## + Fold1.Rep2: alpha=0.550, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold1.Rep2: alpha=0.550, lambda=0.0209 
## + Fold1.Rep2: alpha=0.775, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold1.Rep2: alpha=0.775, lambda=0.0209 
## + Fold1.Rep2: alpha=1.000, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold1.Rep2: alpha=1.000, lambda=0.0209 
## + Fold2.Rep2: alpha=0.100, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold2.Rep2: alpha=0.100, lambda=0.0209 
## + Fold2.Rep2: alpha=0.325, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold2.Rep2: alpha=0.325, lambda=0.0209 
## + Fold2.Rep2: alpha=0.550, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold2.Rep2: alpha=0.550, lambda=0.0209 
## + Fold2.Rep2: alpha=0.775, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold2.Rep2: alpha=0.775, lambda=0.0209 
## + Fold2.Rep2: alpha=1.000, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold2.Rep2: alpha=1.000, lambda=0.0209 
## + Fold3.Rep2: alpha=0.100, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold3.Rep2: alpha=0.100, lambda=0.0209 
## + Fold3.Rep2: alpha=0.325, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold3.Rep2: alpha=0.325, lambda=0.0209 
## + Fold3.Rep2: alpha=0.550, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold3.Rep2: alpha=0.550, lambda=0.0209 
## + Fold3.Rep2: alpha=0.775, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold3.Rep2: alpha=0.775, lambda=0.0209 
## + Fold3.Rep2: alpha=1.000, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold3.Rep2: alpha=1.000, lambda=0.0209 
## + Fold1.Rep3: alpha=0.100, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold1.Rep3: alpha=0.100, lambda=0.0209 
## + Fold1.Rep3: alpha=0.325, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold1.Rep3: alpha=0.325, lambda=0.0209 
## + Fold1.Rep3: alpha=0.550, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold1.Rep3: alpha=0.550, lambda=0.0209 
## + Fold1.Rep3: alpha=0.775, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold1.Rep3: alpha=0.775, lambda=0.0209 
## + Fold1.Rep3: alpha=1.000, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold1.Rep3: alpha=1.000, lambda=0.0209 
## + Fold2.Rep3: alpha=0.100, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold2.Rep3: alpha=0.100, lambda=0.0209 
## + Fold2.Rep3: alpha=0.325, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold2.Rep3: alpha=0.325, lambda=0.0209 
## + Fold2.Rep3: alpha=0.550, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold2.Rep3: alpha=0.550, lambda=0.0209 
## + Fold2.Rep3: alpha=0.775, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold2.Rep3: alpha=0.775, lambda=0.0209 
## + Fold2.Rep3: alpha=1.000, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold2.Rep3: alpha=1.000, lambda=0.0209 
## + Fold3.Rep3: alpha=0.100, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold3.Rep3: alpha=0.100, lambda=0.0209 
## + Fold3.Rep3: alpha=0.325, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold3.Rep3: alpha=0.325, lambda=0.0209 
## + Fold3.Rep3: alpha=0.550, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold3.Rep3: alpha=0.550, lambda=0.0209 
## + Fold3.Rep3: alpha=0.775, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold3.Rep3: alpha=0.775, lambda=0.0209 
## + Fold3.Rep3: alpha=1.000, lambda=0.0209
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## - Fold3.Rep3: alpha=1.000, lambda=0.0209 
## Aggregating results
## Selecting tuning parameters
## Fitting alpha = 0.775, lambda = 0.0209 on full training set
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "ica", n.comp = 3, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff

## [1] "myfit_mdl: train complete: 23.809000 secs"
## Warning in myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst =
## list(id.prefix = bstMdlIdComponents$family, : model's bestTune found at an
## extreme of tuneGrid for parameter: lambda

##             Length Class      Mode     
## a0           35    -none-     numeric  
## beta        105    dgCMatrix  S4       
## df           35    -none-     numeric  
## dim           2    -none-     numeric  
## lambda       35    -none-     numeric  
## dev.ratio    35    -none-     numeric  
## nulldev       1    -none-     numeric  
## npasses       1    -none-     numeric  
## jerr          1    -none-     numeric  
## offset        1    -none-     logical  
## classnames    2    -none-     character
## call          5    -none-     call     
## nobs          1    -none-     numeric  
## lambdaOpt     1    -none-     numeric  
## xNames        3    -none-     character
## problemType   1    -none-     character
## tuneValue     2    data.frame list     
## obsLevels     2    -none-     character
## [1] "min lambda > lambdaOpt:"
## (Intercept)        ICA1        ICA3 
##  0.31594604  0.08593408  0.12497834 
## [1] "max lambda < lambdaOpt:"
## (Intercept)        ICA1        ICA3 
##  0.31616464  0.09239997  0.13152721 
## [1] "myfit_mdl: train diagnostics complete: 24.387000 secs"

##          Prediction
## Reference   D   R
##         D 232 597
##         R 222 913
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   5.829939e-01   8.973221e-02   5.608226e-01   6.049170e-01   5.779022e-01 
## AccuracyPValue  McnemarPValue 
##   3.324889e-01   4.976159e-39

##          Prediction
## Reference   D   R
##         D  10 199
##         R   4 282
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   5.898990e-01   3.872461e-02   5.451295e-01   6.335883e-01   5.777778e-01 
## AccuracyPValue  McnemarPValue 
##   3.090057e-01   3.211368e-42 
## [1] "myfit_mdl: predict complete: 33.948000 secs"
##                     id
## 1 All.X#ica#rcv#glmnet
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             feats
## 1 Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff
##   max.nTuningRuns min.elapsedtime.everything min.elapsedtime.final
## 1              15                     22.942                 0.422
##   max.AUCpROC.fit max.Sens.fit max.Spec.fit max.AUCROCR.fit
## 1       0.5061052   0.02895054    0.9832599        0.575577
##   opt.prob.threshold.fit max.f.score.fit max.Accuracy.fit
## 1                   0.55       0.6903592        0.5804484
##   max.AccuracyLower.fit max.AccuracyUpper.fit max.Kappa.fit
## 1             0.5608226              0.604917    0.01548905
##   max.AUCpROC.OOB max.Sens.OOB max.Spec.OOB max.AUCROCR.OOB
## 1       0.5169304   0.04784689     0.986014       0.5722722
##   opt.prob.threshold.OOB max.f.score.OOB max.Accuracy.OOB
## 1                    0.5       0.7353325         0.589899
##   max.AccuracyLower.OOB max.AccuracyUpper.OOB max.Kappa.OOB
## 1             0.5451295             0.6335883    0.03872461
##   max.AccuracySD.fit max.KappaSD.fit
## 1        0.005085043      0.01503309
## [1] "myfit_mdl: exit: 34.330000 secs"
## [1] "myfit_mdl: enter: 0.001000 secs"
## [1] "myfit_mdl: fitting model: All.X#spatialSign#rcv#glmnet"
## [1] "    indepVar: Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff"
## [1] "myfit_mdl: setup complete: 0.672000 secs"
## Warning in preProcess.default(method = "spatialSign", x =
## structure(c(-0.480112420809766, : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff
## Aggregating results
## Selecting tuning parameters
## Fitting alpha = 0.325, lambda = 0.0377 on full training set
## Warning in preProcess.default(thresh = 0.95, k = 5, method
## = "spatialSign", : These variables have zero variances:
## Q115611.fctrNo:.clusterid.fctr4, Q115611.fctrYes:.clusterid.fctr4,
## Q115611.fctrNo:.clusterid.fctr5, Q115611.fctrYes:.clusterid.fctr5,
## YOB.Age.fctrNA:YOB.Age.dff

## [1] "myfit_mdl: train complete: 22.298000 secs"
## Warning in myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst =
## list(id.prefix = bstMdlIdComponents$family, : model's bestTune found at an
## extreme of tuneGrid for parameter: lambda

##             Length Class      Mode     
## a0             83  -none-     numeric  
## beta        20833  dgCMatrix  S4       
## df             83  -none-     numeric  
## dim             2  -none-     numeric  
## lambda         83  -none-     numeric  
## dev.ratio      83  -none-     numeric  
## nulldev         1  -none-     numeric  
## npasses         1  -none-     numeric  
## jerr            1  -none-     numeric  
## offset          1  -none-     logical  
## classnames      2  -none-     character
## call            5  -none-     call     
## nobs            1  -none-     numeric  
## lambdaOpt       1  -none-     numeric  
## xNames        251  -none-     character
## problemType     1  -none-     character
## tuneValue       2  data.frame list     
## obsLevels       2  -none-     character
## [1] "min lambda > lambdaOpt:"
##                     (Intercept)                      Edn.fctr^6 
##                    0.3285896652                   -0.1083051493 
##                   Hhold.fctrMKy                   Hhold.fctrPKn 
##                    0.3952570568                   -0.8920595299 
##                   Hhold.fctrPKy                   Hhold.fctrSKy 
##                   -0.5085266490                   -0.2354450049 
##                   Income.fctr^5                  Q100562.fctrNo 
##                    0.1370126084                   -0.2312908858 
##                  Q100689.fctrNo                 Q100689.fctrYes 
##                    0.0001435259                   -0.4477790273 
##                 Q101163.fctrDad                  Q104996.fctrNo 
##                    1.2053679521                    0.4521350729 
##                 Q105655.fctrYes                 Q106042.fctrYes 
##                    0.0625911110                   -0.0879620383 
##                  Q106272.fctrNo                 Q106272.fctrYes 
##                   -0.1876800494                    0.0506854747 
##                 Q106388.fctrYes                  Q106997.fctrGr 
##                    0.2580197286                    0.8931599400 
##                  Q106997.fctrYy                 Q107491.fctrYes 
##                   -0.2398917465                   -0.1205896719 
##                Q108855.fctrYes!                  Q110740.fctrPC 
##                    0.9800935004                    0.6300801933 
##                 Q111220.fctrYes                 Q111848.fctrYes 
##                   -0.1017116998                   -0.4166199020 
##                  Q112512.fctrNo                  Q113181.fctrNo 
##                   -0.0642970006                   -1.6911369705 
##                 Q113181.fctrYes                  Q115611.fctrNo 
##                    0.6522689930                   -1.6345038505 
##                 Q115611.fctrYes                  Q115899.fctrCs 
##                    2.4787579445                   -0.1403464665 
##                  Q115899.fctrMe               Q116881.fctrRight 
##                    0.2393979021                    1.4598633343 
##                  Q116953.fctrNo                 Q119334.fctrYes 
##                    0.3036883428                    0.0849216686 
##              Q119650.fctrGiving             Q120472.fctrScience 
##                    0.2165810364                    0.4346347199 
##                  Q121699.fctrNo                 Q122120.fctrYes 
##                    0.0201735219                    0.8243508234 
##                  Q122771.fctrPt                 Q123621.fctrYes 
##                    0.0659253587                    0.4275148439 
##                  Q124742.fctrNo                  Q98059.fctrYes 
##                   -0.0833654825                   -0.5460025571 
##                   Q98197.fctrNo                   Q98869.fctrNo 
##                   -1.1595064796                   -0.9115034830 
##                   Q99480.fctrNo                  Q99716.fctrYes 
##                   -0.7675816884                   -0.2651929719 
## Q115611.fctrNo:.clusterid.fctr2 Q115611.fctrNA:.clusterid.fctr5 
##                    0.2394614329                    0.1621440523 
## [1] "max lambda < lambdaOpt:"
##                     (Intercept)                      Edn.fctr^6 
##                     0.329665930                    -0.184472250 
##                   Hhold.fctrMKy                   Hhold.fctrPKn 
##                     0.429181534                    -0.960013796 
##                   Hhold.fctrPKy                   Hhold.fctrSKn 
##                    -0.597580760                    -0.053624168 
##                   Hhold.fctrSKy                   Income.fctr.C 
##                    -0.317073552                     0.049504226 
##                   Income.fctr^5                   Income.fctr^6 
##                     0.213257458                    -0.036987829 
##                  Q100562.fctrNo                  Q100689.fctrNo 
##                    -0.289311516                     0.070568813 
##                 Q100689.fctrYes                 Q101163.fctrDad 
##                    -0.489765683                     1.266596632 
##                  Q104996.fctrNo                 Q105655.fctrYes 
##                     0.550009541                     0.127975959 
##                 Q106042.fctrYes                  Q106272.fctrNo 
##                    -0.146327136                    -0.202359894 
##                 Q106272.fctrYes                 Q106388.fctrYes 
##                     0.084650881                     0.295166794 
##                  Q106997.fctrGr                  Q106997.fctrYy 
##                     0.976785034                    -0.277714678 
##                 Q107491.fctrYes                Q108855.fctrYes! 
##                    -0.205039156                     1.054889798 
##                 Q110740.fctrMac                  Q110740.fctrPC 
##                    -0.015452904                     0.690659171 
##                 Q111220.fctrYes                 Q111848.fctrYes 
##                    -0.185833681                    -0.519599732 
##                  Q112512.fctrNo                  Q113181.fctrNo 
##                    -0.137159222                    -1.759340985 
##                 Q113181.fctrYes                  Q114517.fctrNo 
##                     0.619836399                    -0.012318451 
##                  Q115611.fctrNo                 Q115611.fctrYes 
##                    -1.683914757                     2.520722357 
##                  Q115899.fctrCs                  Q115899.fctrMe 
##                    -0.201818877                     0.257334171 
##                  Q116601.fctrNo                 Q116601.fctrYes 
##                    -0.003285330                     0.050710230 
##               Q116881.fctrRight                  Q116953.fctrNo 
##                     1.497064902                     0.361758936 
##      Q117193.fctrStandard hours                 Q119334.fctrYes 
##                     0.040037629                     0.122547997 
##              Q119650.fctrGiving         Q120194.fctrStudy first 
##                     0.299153888                    -0.066822193 
##             Q120472.fctrScience                  Q121699.fctrNo 
##                     0.482006286                     0.092742755 
##                 Q122120.fctrYes                  Q122771.fctrPt 
##                     0.912711660                     0.107102798 
##                 Q123621.fctrYes                 Q124122.fctrYes 
##                     0.499353260                    -0.074964321 
##                  Q124742.fctrNo                  Q98059.fctrYes 
##                    -0.159976200                    -0.652014362 
##                   Q98197.fctrNo                   Q98869.fctrNo 
##                    -1.136301082                    -0.968667764 
##                   Q99480.fctrNo                  Q99716.fctrYes 
##                    -0.808933650                    -0.295858350 
## Q115611.fctrNo:.clusterid.fctr2 Q115611.fctrNA:.clusterid.fctr5 
##                     0.321424169                     0.249894406 
## YOB.Age.fctr(35,40]:YOB.Age.dff YOB.Age.fctr(65,90]:YOB.Age.dff 
##                    -0.024459789                    -0.009170293 
## [1] "myfit_mdl: train diagnostics complete: 22.936000 secs"

##          Prediction
## Reference   D   R
##         D 463 366
##         R 319 816
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   6.512220e-01   2.795837e-01   6.296765e-01   6.723151e-01   5.779022e-01 
## AccuracyPValue  McnemarPValue 
##   1.804262e-11   7.882076e-02

##          Prediction
## Reference   D   R
##         D  34 175
##         R  27 259
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   5.919192e-01   7.546786e-02   5.471702e-01   6.355636e-01   5.777778e-01 
## AccuracyPValue  McnemarPValue 
##   2.776271e-01   4.507644e-25 
## [1] "myfit_mdl: predict complete: 33.545000 secs"
##                             id
## 1 All.X#spatialSign#rcv#glmnet
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             feats
## 1 Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff
##   max.nTuningRuns min.elapsedtime.everything min.elapsedtime.final
## 1              25                     21.528                  1.88
##   max.AUCpROC.fit max.Sens.fit max.Spec.fit max.AUCROCR.fit
## 1       0.6105095    0.3884198    0.8325991       0.6815483
##   opt.prob.threshold.fit max.f.score.fit max.Accuracy.fit
## 1                   0.55       0.7043591        0.6070928
##   max.AccuracyLower.fit max.AccuracyUpper.fit max.Kappa.fit
## 1             0.6296765             0.6723151     0.1519254
##   max.AUCpROC.OOB max.Sens.OOB max.Spec.OOB max.AUCROCR.OOB
## 1       0.5405778    0.3014354    0.7797203       0.5713688
##   opt.prob.threshold.OOB max.f.score.OOB max.Accuracy.OOB
## 1                   0.45       0.7194444        0.5919192
##   max.AccuracyLower.OOB max.AccuracyUpper.OOB max.Kappa.OOB
## 1             0.5471702             0.6355636    0.07546786
##   max.AccuracySD.fit max.KappaSD.fit
## 1         0.01350937      0.02893965
## [1] "myfit_mdl: exit: 34.300000 secs"
## [1] "myfit_mdl: enter: 0.000000 secs"
## [1] "myfit_mdl: fitting model: All.X#conditionalX#rcv#glmnet"
## [1] "    indepVar: Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff"
## [1] "myfit_mdl: setup complete: 0.733000 secs"
## Aggregating results
## Selecting tuning parameters
## Fitting alpha = 0.55, lambda = 0.0376 on full training set
## [1] "myfit_mdl: train complete: 14.698000 secs"
## Warning in myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst =
## list(id.prefix = bstMdlIdComponents$family, : model's bestTune found at an
## extreme of tuneGrid for parameter: lambda

##             Length Class      Mode     
## a0             82  -none-     numeric  
## beta        20582  dgCMatrix  S4       
## df             82  -none-     numeric  
## dim             2  -none-     numeric  
## lambda         82  -none-     numeric  
## dev.ratio      82  -none-     numeric  
## nulldev         1  -none-     numeric  
## npasses         1  -none-     numeric  
## jerr            1  -none-     numeric  
## offset          1  -none-     logical  
## classnames      2  -none-     character
## call            5  -none-     call     
## nobs            1  -none-     numeric  
## lambdaOpt       1  -none-     numeric  
## xNames        251  -none-     character
## problemType     1  -none-     character
## tuneValue       2  data.frame list     
## obsLevels       2  -none-     character
## [1] "min lambda > lambdaOpt:"
##       (Intercept)     Hhold.fctrMKy     Hhold.fctrPKn   Q101163.fctrDad 
##        0.23798411        0.01874708       -0.13442634        0.09255838 
##    Q106997.fctrGr  Q108855.fctrYes!    Q110740.fctrPC    Q113181.fctrNo 
##        0.04606394        0.05583211        0.02832168       -0.17278645 
##   Q113181.fctrYes    Q115611.fctrNo   Q115611.fctrYes Q116881.fctrRight 
##        0.08695903       -0.13399486        0.36549211        0.17630958 
##   Q122120.fctrYes   Q123621.fctrYes     Q98197.fctrNo     Q98869.fctrNo 
##        0.04163127        0.00229355       -0.14923426       -0.08488000 
##     Q99480.fctrNo 
##       -0.08339722 
## [1] "max lambda < lambdaOpt:"
##         (Intercept)       Hhold.fctrMKy       Hhold.fctrPKn 
##         0.216260115         0.027552836        -0.172608767 
##     Q101163.fctrDad     Q106388.fctrYes      Q106997.fctrGr 
##         0.104315647         0.004549068         0.066207479 
##    Q108855.fctrYes!      Q110740.fctrPC      Q113181.fctrNo 
##         0.071265356         0.042228759        -0.188579678 
##     Q113181.fctrYes      Q115611.fctrNo     Q115611.fctrYes 
##         0.078590932        -0.148973794         0.363232265 
##   Q116881.fctrRight Q120472.fctrScience     Q122120.fctrYes 
##         0.190801458         0.009230062         0.061075685 
##     Q123621.fctrYes       Q98197.fctrNo       Q98869.fctrNo 
##         0.010278853        -0.157484555        -0.099872253 
##       Q99480.fctrNo 
##        -0.095613180 
## [1] "myfit_mdl: train diagnostics complete: 15.348000 secs"

##          Prediction
## Reference   D   R
##         D 429 400
##         R 322 813
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   6.323829e-01   2.367939e-01   6.106194e-01   6.537503e-01   5.779022e-01 
## AccuracyPValue  McnemarPValue 
##   4.843674e-07   4.161629e-03

##          Prediction
## Reference   D   R
##         D  16 193
##         R   8 278
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   5.939394e-01   5.515512e-02   5.492118e-01   6.375382e-01   5.777778e-01 
## AccuracyPValue  McnemarPValue 
##   2.478775e-01   1.623204e-38 
## [1] "myfit_mdl: predict complete: 24.466000 secs"
##                              id
## 1 All.X#conditionalX#rcv#glmnet
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             feats
## 1 Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff
##   max.nTuningRuns min.elapsedtime.everything min.elapsedtime.final
## 1              25                     13.887                 1.291
##   max.AUCpROC.fit max.Sens.fit max.Spec.fit max.AUCROCR.fit
## 1       0.5838976     0.318456    0.8493392       0.6603466
##   opt.prob.threshold.fit max.f.score.fit max.Accuracy.fit
## 1                   0.55       0.6925043        0.6098108
##   max.AccuracyLower.fit max.AccuracyUpper.fit max.Kappa.fit
## 1             0.6106194             0.6537503     0.1457828
##   max.AUCpROC.OOB max.Sens.OOB max.Spec.OOB max.AUCROCR.OOB
## 1       0.5441664    0.2631579    0.8251748       0.5655804
##   opt.prob.threshold.OOB max.f.score.OOB max.Accuracy.OOB
## 1                   0.45       0.7344782        0.5939394
##   max.AccuracyLower.OOB max.AccuracyUpper.OOB max.Kappa.OOB
## 1             0.5492118             0.6375382    0.05515512
##   max.AccuracySD.fit max.KappaSD.fit
## 1         0.01567398      0.03089611
## [1] "myfit_mdl: exit: 24.742000 secs"
## [1] "myfit_mdl: enter: 0.001000 secs"
## [1] "myfit_mdl: fitting model: All.X#zv.pca.spatialSign#rcv#glmnet"
## [1] "    indepVar: Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff"
## [1] "myfit_mdl: setup complete: 0.672000 secs"
## + Fold1.Rep1: alpha=0.100, lambda=0.03768 
## - Fold1.Rep1: alpha=0.100, lambda=0.03768 
## + Fold1.Rep1: alpha=0.325, lambda=0.03768 
## - Fold1.Rep1: alpha=0.325, lambda=0.03768 
## + Fold1.Rep1: alpha=0.550, lambda=0.03768 
## - Fold1.Rep1: alpha=0.550, lambda=0.03768 
## + Fold1.Rep1: alpha=0.775, lambda=0.03768 
## - Fold1.Rep1: alpha=0.775, lambda=0.03768 
## + Fold1.Rep1: alpha=1.000, lambda=0.03768 
## - Fold1.Rep1: alpha=1.000, lambda=0.03768 
## + Fold2.Rep1: alpha=0.100, lambda=0.03768 
## - Fold2.Rep1: alpha=0.100, lambda=0.03768 
## + Fold2.Rep1: alpha=0.325, lambda=0.03768 
## - Fold2.Rep1: alpha=0.325, lambda=0.03768 
## + Fold2.Rep1: alpha=0.550, lambda=0.03768 
## - Fold2.Rep1: alpha=0.550, lambda=0.03768 
## + Fold2.Rep1: alpha=0.775, lambda=0.03768 
## - Fold2.Rep1: alpha=0.775, lambda=0.03768 
## + Fold2.Rep1: alpha=1.000, lambda=0.03768 
## - Fold2.Rep1: alpha=1.000, lambda=0.03768 
## + Fold3.Rep1: alpha=0.100, lambda=0.03768 
## - Fold3.Rep1: alpha=0.100, lambda=0.03768 
## + Fold3.Rep1: alpha=0.325, lambda=0.03768 
## - Fold3.Rep1: alpha=0.325, lambda=0.03768 
## + Fold3.Rep1: alpha=0.550, lambda=0.03768 
## - Fold3.Rep1: alpha=0.550, lambda=0.03768 
## + Fold3.Rep1: alpha=0.775, lambda=0.03768 
## - Fold3.Rep1: alpha=0.775, lambda=0.03768 
## + Fold3.Rep1: alpha=1.000, lambda=0.03768 
## - Fold3.Rep1: alpha=1.000, lambda=0.03768 
## + Fold1.Rep2: alpha=0.100, lambda=0.03768 
## - Fold1.Rep2: alpha=0.100, lambda=0.03768 
## + Fold1.Rep2: alpha=0.325, lambda=0.03768 
## - Fold1.Rep2: alpha=0.325, lambda=0.03768 
## + Fold1.Rep2: alpha=0.550, lambda=0.03768 
## - Fold1.Rep2: alpha=0.550, lambda=0.03768 
## + Fold1.Rep2: alpha=0.775, lambda=0.03768 
## - Fold1.Rep2: alpha=0.775, lambda=0.03768 
## + Fold1.Rep2: alpha=1.000, lambda=0.03768 
## - Fold1.Rep2: alpha=1.000, lambda=0.03768 
## + Fold2.Rep2: alpha=0.100, lambda=0.03768 
## - Fold2.Rep2: alpha=0.100, lambda=0.03768 
## + Fold2.Rep2: alpha=0.325, lambda=0.03768 
## - Fold2.Rep2: alpha=0.325, lambda=0.03768 
## + Fold2.Rep2: alpha=0.550, lambda=0.03768 
## - Fold2.Rep2: alpha=0.550, lambda=0.03768 
## + Fold2.Rep2: alpha=0.775, lambda=0.03768 
## - Fold2.Rep2: alpha=0.775, lambda=0.03768 
## + Fold2.Rep2: alpha=1.000, lambda=0.03768 
## - Fold2.Rep2: alpha=1.000, lambda=0.03768 
## + Fold3.Rep2: alpha=0.100, lambda=0.03768 
## - Fold3.Rep2: alpha=0.100, lambda=0.03768 
## + Fold3.Rep2: alpha=0.325, lambda=0.03768 
## - Fold3.Rep2: alpha=0.325, lambda=0.03768 
## + Fold3.Rep2: alpha=0.550, lambda=0.03768 
## - Fold3.Rep2: alpha=0.550, lambda=0.03768 
## + Fold3.Rep2: alpha=0.775, lambda=0.03768 
## - Fold3.Rep2: alpha=0.775, lambda=0.03768 
## + Fold3.Rep2: alpha=1.000, lambda=0.03768 
## - Fold3.Rep2: alpha=1.000, lambda=0.03768 
## + Fold1.Rep3: alpha=0.100, lambda=0.03768 
## - Fold1.Rep3: alpha=0.100, lambda=0.03768 
## + Fold1.Rep3: alpha=0.325, lambda=0.03768 
## - Fold1.Rep3: alpha=0.325, lambda=0.03768 
## + Fold1.Rep3: alpha=0.550, lambda=0.03768 
## - Fold1.Rep3: alpha=0.550, lambda=0.03768 
## + Fold1.Rep3: alpha=0.775, lambda=0.03768 
## - Fold1.Rep3: alpha=0.775, lambda=0.03768 
## + Fold1.Rep3: alpha=1.000, lambda=0.03768 
## - Fold1.Rep3: alpha=1.000, lambda=0.03768 
## + Fold2.Rep3: alpha=0.100, lambda=0.03768 
## - Fold2.Rep3: alpha=0.100, lambda=0.03768 
## + Fold2.Rep3: alpha=0.325, lambda=0.03768 
## - Fold2.Rep3: alpha=0.325, lambda=0.03768 
## + Fold2.Rep3: alpha=0.550, lambda=0.03768 
## - Fold2.Rep3: alpha=0.550, lambda=0.03768 
## + Fold2.Rep3: alpha=0.775, lambda=0.03768 
## - Fold2.Rep3: alpha=0.775, lambda=0.03768 
## + Fold2.Rep3: alpha=1.000, lambda=0.03768 
## - Fold2.Rep3: alpha=1.000, lambda=0.03768 
## + Fold3.Rep3: alpha=0.100, lambda=0.03768 
## - Fold3.Rep3: alpha=0.100, lambda=0.03768 
## + Fold3.Rep3: alpha=0.325, lambda=0.03768 
## - Fold3.Rep3: alpha=0.325, lambda=0.03768 
## + Fold3.Rep3: alpha=0.550, lambda=0.03768 
## - Fold3.Rep3: alpha=0.550, lambda=0.03768 
## + Fold3.Rep3: alpha=0.775, lambda=0.03768 
## - Fold3.Rep3: alpha=0.775, lambda=0.03768 
## + Fold3.Rep3: alpha=1.000, lambda=0.03768 
## - Fold3.Rep3: alpha=1.000, lambda=0.03768 
## Aggregating results
## Selecting tuning parameters
## Fitting alpha = 0.325, lambda = 0.0377 on full training set
## [1] "myfit_mdl: train complete: 586.091000 secs"
## Warning in myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst =
## list(id.prefix = bstMdlIdComponents$family, : model's bestTune found at an
## extreme of tuneGrid for parameter: lambda

##             Length Class      Mode     
## a0            100  -none-     numeric  
## beta        38500  dgCMatrix  S4       
## df            100  -none-     numeric  
## dim             2  -none-     numeric  
## lambda        100  -none-     numeric  
## dev.ratio     100  -none-     numeric  
## nulldev         1  -none-     numeric  
## npasses         1  -none-     numeric  
## jerr            1  -none-     numeric  
## offset          1  -none-     logical  
## classnames      2  -none-     character
## call            5  -none-     call     
## nobs            1  -none-     numeric  
## lambdaOpt       1  -none-     numeric  
## xNames        385  -none-     character
## problemType     1  -none-     character
## tuneValue       2  data.frame list     
## obsLevels       2  -none-     character
## [1] "min lambda > lambdaOpt:"
##                     (Intercept)                      Edn.fctr^6 
##                     0.329991765                    -0.052919874 
##                   Hhold.fctrMKy                   Hhold.fctrPKn 
##                     0.407893163                    -0.494920989 
##                   Hhold.fctrPKy                   Hhold.fctrSKn 
##                    -0.262124055                    -0.148876655 
##                  Q100562.fctrNo                  Q100689.fctrNo 
##                    -0.424057583                     0.003983168 
##                 Q100689.fctrYes                 Q101163.fctrDad 
##                    -0.356400700                     1.069891386 
##                  Q104996.fctrNo                 Q106042.fctrYes 
##                     0.271864079                    -0.149781433 
##                  Q106272.fctrNo                 Q106388.fctrYes 
##                    -0.208271429                     0.305149471 
##                  Q106997.fctrGr                  Q106997.fctrYy 
##                     0.694613791                    -0.250527691 
##                 Q107491.fctrYes                Q108855.fctrYes! 
##                    -0.009759907                     0.710454016 
##                 Q110740.fctrMac                  Q110740.fctrPC 
##                    -0.032018155                     0.464848180 
##                 Q111220.fctrYes                 Q111848.fctrYes 
##                    -0.064630216                    -0.095160073 
##                  Q113181.fctrNo                 Q113181.fctrYes 
##                    -1.522244959                     0.676586996 
##                  Q115611.fctrNo                 Q115611.fctrYes 
##                    -1.413046501                     2.369378010 
##                  Q115899.fctrCs                  Q115899.fctrMe 
##                    -0.055117406                     0.140114962 
##               Q116881.fctrRight                  Q116953.fctrNo 
##                     1.403024979                     0.137827982 
##      Q117193.fctrStandard hours                 Q119334.fctrYes 
##                     0.090827982                     0.080953399 
##              Q119650.fctrGiving             Q120472.fctrScience 
##                     0.054937481                     0.271856261 
##                 Q122120.fctrYes                 Q123621.fctrYes 
##                     0.605512533                     0.377268243 
##                  Q98059.fctrYes                   Q98197.fctrNo 
##                    -0.345475132                    -1.054566193 
##                   Q98869.fctrNo                   Q99480.fctrNo 
##                    -0.786995824                    -0.737861700 
##                  Q99716.fctrYes Q115611.fctrNo:.clusterid.fctr2 
##                    -0.085849329                     0.084813863 
## YOB.Age.fctr(40,50]:YOB.Age.dff                             PC3 
##                     0.001897725                    -0.004662543 
##                             PC7                             PC9 
##                    -0.019589189                    -0.001243451 
##                            PC13                            PC14 
##                     0.010210744                    -0.020008412 
##                            PC17                            PC24 
##                     0.002954924                    -0.001727598 
##                            PC26                            PC41 
##                    -0.008565914                     0.013830991 
##                            PC43                            PC50 
##                     0.014920820                    -0.006278934 
##                            PC52                            PC56 
##                    -0.006270187                    -0.009209784 
##                            PC68                            PC82 
##                     0.044920443                     0.001240941 
##                            PC90                            PC91 
##                    -0.002693600                    -0.004491710 
##                            PC94                            PC97 
##                    -0.022397273                    -0.008558782 
##                           PC106                           PC113 
##                     0.037455415                    -0.041304970 
##                           PC119                           PC120 
##                    -0.024838795                     0.023447012 
##                           PC121                           PC131 
##                    -0.061150797                    -0.007979888 
##                           PC132                           PC133 
##                    -0.001010211                    -0.028441375 
## [1] "max lambda < lambdaOpt:"
##                     (Intercept)                      Edn.fctr^6 
##                    0.3314268864                   -0.1478894944 
##                   Hhold.fctrMKy                   Hhold.fctrPKn 
##                    0.4319963050                   -0.5122106403 
##                   Hhold.fctrPKy                   Hhold.fctrSKn 
##                   -0.2805944855                   -0.2182106427 
##                   Income.fctr^6                  Q100562.fctrNo 
##                   -0.0060717225                   -0.4791515059 
##                  Q100689.fctrNo                 Q100689.fctrYes 
##                    0.0604714353                   -0.4049740314 
##                 Q101163.fctrDad                  Q104996.fctrNo 
##                    1.1299829953                    0.3555893748 
##                 Q104996.fctrYes                 Q105655.fctrYes 
##                   -0.0047951607                    0.0314608980 
##                 Q106042.fctrYes                  Q106272.fctrNo 
##                   -0.2198262377                   -0.2418399889 
##                 Q106388.fctrYes                  Q106997.fctrGr 
##                    0.3571553662                    0.7443744524 
##                  Q106997.fctrYy                 Q107491.fctrYes 
##                   -0.2799701232                   -0.0677995130 
##                Q108855.fctrYes!                 Q110740.fctrMac 
##                    0.7478598853                   -0.0715001718 
##                  Q110740.fctrPC                 Q111220.fctrYes 
##                    0.5070330383                   -0.1238869380 
##                 Q111848.fctrYes                  Q113181.fctrNo 
##                   -0.1765378901                   -1.5553735772 
##                 Q113181.fctrYes                  Q115611.fctrNo 
##                    0.6719922874                   -1.4478802162 
##                 Q115611.fctrYes                  Q115899.fctrCs 
##                    2.4135494125                   -0.1040042897 
##                  Q115899.fctrMe               Q116881.fctrRight 
##                    0.1350056999                    1.4309445669 
##                  Q116953.fctrNo      Q117193.fctrStandard hours 
##                    0.2132673290                    0.1581146461 
##                 Q119334.fctrYes              Q119650.fctrGiving 
##                    0.1076022270                    0.1030371035 
##             Q120472.fctrScience                 Q122120.fctrYes 
##                    0.2914142541                    0.6530497413 
##                 Q123621.fctrYes                  Q98059.fctrYes 
##                    0.3944701882                   -0.4264209459 
##                   Q98197.fctrNo                   Q98869.fctrNo 
##                   -1.0255706012                   -0.8123131119 
##                   Q99480.fctrNo                  Q99716.fctrYes 
##                   -0.7708797212                   -0.0960683143 
## Q115611.fctrNo:.clusterid.fctr2 Q115611.fctrNA:.clusterid.fctr5 
##                    0.1591960411                    0.0238766175 
## YOB.Age.fctr(40,50]:YOB.Age.dff                             PC3 
##                    0.0660827303                   -0.0056148487 
##                             PC7                             PC9 
##                   -0.0201719445                   -0.0024314081 
##                            PC13                            PC14 
##                    0.0117636327                   -0.0224839484 
##                            PC17                            PC24 
##                    0.0042120325                   -0.0025782874 
##                            PC26                            PC31 
##                   -0.0111706115                   -0.0004018937 
##                            PC41                            PC43 
##                    0.0136460272                    0.0171298367 
##                            PC44                            PC50 
##                    0.0001214101                   -0.0093947928 
##                            PC52                            PC56 
##                   -0.0076113106                   -0.0115042050 
##                            PC68                            PC82 
##                    0.0465172309                    0.0049964697 
##                            PC90                            PC91 
##                   -0.0066533657                   -0.0079880386 
##                            PC94                            PC97 
##                   -0.0249234875                   -0.0114614175 
##                           PC106                           PC109 
##                    0.0405008558                    0.0005246326 
##                           PC113                           PC119 
##                   -0.0461143941                   -0.0296316491 
##                           PC120                           PC121 
##                    0.0286564064                   -0.0672517909 
##                           PC131                           PC132 
##                   -0.0128706092                   -0.0067850811 
##                           PC133 
##                   -0.0330433143 
## [1] "myfit_mdl: train diagnostics complete: 586.793000 secs"

##          Prediction
## Reference   D   R
##         D 471 358
##         R 323 812
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   6.532587e-01   2.851960e-01   6.317388e-01   6.743199e-01   5.779022e-01 
## AccuracyPValue  McnemarPValue 
##   5.012357e-12   1.926148e-01

##          Prediction
## Reference   D   R
##         D  37 172
##         R  28 258
##       Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
##   5.959596e-01   8.722110e-02   5.512541e-01   6.395120e-01   5.777778e-01 
## AccuracyPValue  McnemarPValue 
##   2.199066e-01   4.906264e-24 
## [1] "myfit_mdl: predict complete: 597.013000 secs"
##                                    id
## 1 All.X#zv.pca.spatialSign#rcv#glmnet
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             feats
## 1 Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,Q115611.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff
##   max.nTuningRuns min.elapsedtime.everything min.elapsedtime.final
## 1              25                     585.34                 15.68
##   max.AUCpROC.fit max.Sens.fit max.Spec.fit max.AUCROCR.fit
## 1        0.608978    0.3835947    0.8343612       0.6868814
##   opt.prob.threshold.fit max.f.score.fit max.Accuracy.fit
## 1                   0.55       0.7045553        0.6064166
##   max.AccuracyLower.fit max.AccuracyUpper.fit max.Kappa.fit
## 1             0.6317388             0.6743199      0.154141
##   max.AUCpROC.OOB max.Sens.OOB max.Spec.OOB max.AUCROCR.OOB
## 1       0.5403938    0.2870813    0.7937063       0.5850035
##   opt.prob.threshold.OOB max.f.score.OOB max.Accuracy.OOB
## 1                   0.45       0.7206704        0.5959596
##   max.AccuracyLower.OOB max.AccuracyUpper.OOB max.Kappa.OOB
## 1             0.5512541              0.639512     0.0872211
##   max.AccuracySD.fit max.KappaSD.fit
## 1         0.01534983      0.03191194
## [1] "myfit_mdl: exit: 597.825000 secs"
##                                     min.elapsedtime.everything
## Random###myrandom_classfr                                0.277
## MFO###myMFO_classfr                                      0.373
## Max.cor.Y.rcv.1X1###glmnet                               0.738
## Max.cor.Y##rcv#rpart                                     1.449
## All.X##rcv#glmnet                                       13.297
## All.X#conditionalX#rcv#glmnet                           13.887
## Low.cor.X##rcv#glmnet                                   14.519
## All.X#center#rcv#glmnet                                 15.011
## All.X#scale#rcv#glmnet                                  15.038
## All.X#zv#rcv#glmnet                                     15.047
## All.X#center.scale#rcv#glmnet                           15.805
## All.X#range#rcv#glmnet                                  16.349
## All.X#BoxCox#rcv#glmnet                                 17.083
## All.X#nzv#rcv#glmnet                                    19.195
## All.X#spatialSign#rcv#glmnet                            21.528
## All.X#ica#rcv#glmnet                                    22.942
## All.X#zv.pca#rcv#glmnet                                 36.825
## All.X#YeoJohnson#rcv#glmnet                             51.262
## All.X#expoTrans#rcv#glmnet                              52.761
## All.X#zv.pca.spatialSign#rcv#glmnet                    585.340
##                  label step_major step_minor label_minor      bgn      end
## 4 fit.models_1_preProc          1          3     preProc   38.976 1097.558
## 5     fit.models_1_end          1          4    teardown 1097.559       NA
##    elapsed
## 4 1058.582
## 5       NA
##          label step_major step_minor label_minor      bgn      end
## 1 fit.models_1          1          0           0    9.489 1097.568
## 2   fit.models          1          1           1 1097.568       NA
##    elapsed
## 1 1088.079
## 2       NA

```{r fit.models_2, cache=FALSE, fig.height=10, fig.width=15, eval=myevlChunk(glbChunks, glbOut$pfx)}

##              label step_major step_minor label_minor      bgn end elapsed
## 1 fit.models_2_bgn          1          0       setup 1149.703  NA      NA
## Warning: max.AccuracyUpper.fit already exists in glb_models_df
## [1] "var:max.KappaSD.fit"
## Warning: Removed 3 rows containing missing values (geom_errorbar).
## quartz_off_screen 
##                 2
## Warning: Removed 3 rows containing missing values (geom_errorbar).

##                                     id max.Accuracy.OOB max.AUCROCR.OOB
## 16             All.X#zv.pca#rcv#glmnet        0.6020202       0.6000268
## 20 All.X#zv.pca.spatialSign#rcv#glmnet        0.5959596       0.5850035
## 19       All.X#conditionalX#rcv#glmnet        0.5939394       0.5655804
## 5                Low.cor.X##rcv#glmnet        0.5939394       0.5655804
## 12             All.X#center#rcv#glmnet        0.5939394       0.5655804
## 13              All.X#scale#rcv#glmnet        0.5939394       0.5655804
## 7                  All.X#zv#rcv#glmnet        0.5939394       0.5655804
## 14       All.X#center.scale#rcv#glmnet        0.5939394       0.5655804
## 15              All.X#range#rcv#glmnet        0.5939394       0.5655804
## 9              All.X#BoxCox#rcv#glmnet        0.5939394       0.5655804
## 10         All.X#YeoJohnson#rcv#glmnet        0.5939394       0.5655804
## 11          All.X#expoTrans#rcv#glmnet        0.5939394       0.5655804
## 18        All.X#spatialSign#rcv#glmnet        0.5919192       0.5713688
## 8                 All.X#nzv#rcv#glmnet        0.5919192       0.5617158
## 17                All.X#ica#rcv#glmnet        0.5898990       0.5722722
## 6                    All.X##rcv#glmnet        0.5838384       0.5631880
## 3           Max.cor.Y.rcv.1X1###glmnet        0.5777778       0.5358433
## 4                 Max.cor.Y##rcv#rpart        0.5777778       0.5169806
## 2            Random###myrandom_classfr        0.5777778       0.5145381
## 1                  MFO###myMFO_classfr        0.5777778       0.5000000
##    max.AUCpROC.OOB min.elapsedtime.everything max.Accuracy.fit
## 16       0.5473868                     36.825        0.5930076
## 20       0.5403938                    585.340        0.6064166
## 19       0.5441664                     13.887        0.6098108
## 5        0.5441664                     14.519        0.6098108
## 12       0.5441664                     15.011        0.6098108
## 13       0.5441664                     15.038        0.6098108
## 7        0.5441664                     15.047        0.6098108
## 14       0.5441664                     15.805        0.6098108
## 15       0.5441664                     16.349        0.6098108
## 9        0.5441664                     17.083        0.6098108
## 10       0.5441664                     51.262        0.6093019
## 11       0.5441664                     52.761        0.6089627
## 18       0.5405778                     21.528        0.6070928
## 8        0.5358852                     19.195        0.6086221
## 17       0.5169304                     22.942        0.5804484
## 6        0.5374494                     13.297        0.6094700
## 3        0.5274199                      0.738        0.6181263
## 4        0.5274199                      1.449        0.6140468
## 2        0.5026684                      0.277        0.5779022
## 1        0.5000000                      0.373        0.5779022
##    opt.prob.threshold.fit opt.prob.threshold.OOB
## 16                   0.55                   0.50
## 20                   0.55                   0.45
## 19                   0.55                   0.45
## 5                    0.55                   0.45
## 12                   0.55                   0.45
## 13                   0.55                   0.45
## 7                    0.55                   0.45
## 14                   0.55                   0.45
## 15                   0.55                   0.45
## 9                    0.55                   0.45
## 10                   0.55                   0.45
## 11                   0.55                   0.45
## 18                   0.55                   0.45
## 8                    0.55                   0.45
## 17                   0.55                   0.50
## 6                    0.55                   0.50
## 3                    0.50                   0.40
## 4                    0.50                   0.40
## 2                    0.40                   0.40
## 1                    0.40                   0.40
## [1] "Metrics used for model selection:"
## ~-max.Accuracy.OOB - max.AUCROCR.OOB - max.AUCpROC.OOB + min.elapsedtime.everything - 
##     max.Accuracy.fit - opt.prob.threshold.OOB
## <environment: 0x7f82c190aee8>
## [1] "Best model id: All.X#zv.pca#rcv#glmnet"
## glmnet 
## 
## 1964 samples
##  108 predictor
##    2 classes: 'D', 'R' 
## 
## Pre-processing: principal component signal extraction (246),
##  centered (246), scaled (246), remove (5) 
## Resampling: Cross-Validated (3 fold, repeated 3 times) 
## Summary of sample sizes: 1310, 1309, 1309, 1309, 1309, 1310, ... 
## Resampling results across tuning parameters:
## 
##   alpha  lambda      Accuracy   Kappa      
##   0.100  0.00556155  0.5736655  0.105761752
##   0.100  0.01000000  0.5753619  0.107848508
##   0.100  0.02581443  0.5760386  0.102785240
##   0.100  0.03000000  0.5777371  0.104665284
##   0.100  0.04606730  0.5799415  0.102139451
##   0.325  0.00556155  0.5734954  0.103290210
##   0.325  0.01000000  0.5753598  0.103546282
##   0.325  0.02581443  0.5860502  0.107159939
##   0.325  0.03000000  0.5858801  0.102051845
##   0.325  0.04606730  0.5913100  0.091459883
##   0.550  0.00556155  0.5751902  0.104648563
##   0.550  0.01000000  0.5809588  0.109976920
##   0.550  0.02581443  0.5913107  0.099927379
##   0.550  0.03000000  0.5930076  0.094553658
##   0.550  0.04606730  0.5824845  0.031251211
##   0.775  0.00556155  0.5775656  0.106669097
##   0.775  0.01000000  0.5819753  0.105869679
##   0.775  0.02581443  0.5901212  0.074988856
##   0.775  0.03000000  0.5860476  0.052246960
##   0.775  0.04606730  0.5784114  0.004847568
##   1.000  0.00556155  0.5785824  0.106017920
##   1.000  0.01000000  0.5857099  0.106012057
##   1.000  0.02581443  0.5826549  0.036229940
##   1.000  0.03000000  0.5792609  0.015558626
##   1.000  0.04606730  0.5782421  0.001053919
## 
## Accuracy was used to select the optimal model using  the largest value.
## The final values used for the model were alpha = 0.55 and lambda = 0.03.
## [1] "All.X#zv.pca#rcv#glmnet fit prediction diagnostics:"
## [1] "All.X#zv.pca#rcv#glmnet OOB prediction diagnostics:"
##       All.X.zv.pca.rcv.glmnet.imp         imp
## PC7                   100.0000000 100.0000000
## PC13                   75.4538829  75.4538829
## PC68                   66.3840885  66.3840885
## PC14                   64.5064714  64.5064714
## PC9                    58.5960375  58.5960375
## PC121                  54.1806538  54.1806538
## PC3                    51.2647548  51.2647548
## PC106                  38.2802223  38.2802223
## PC113                  37.8999399  37.8999399
## PC119                  35.4884723  35.4884723
## PC43                   31.6757592  31.6757592
## PC41                   31.1987960  31.1987960
## PC2                    29.3766671  29.3766671
## PC94                   21.2832245  21.2832245
## PC17                   18.7444456  18.7444456
## PC5                    16.3764866  16.3764866
## PC24                   15.2596035  15.2596035
## PC120                  10.7716891  10.7716891
## PC6                     8.1980805   8.1980805
## PC28                    7.5438596   7.5438596
## PC133                   6.6940287   6.6940287
## PC25                    6.4806736   6.4806736
## PC26                    5.6691496   5.6691496
## PC34                    3.1818291   3.1818291
## PC4                     2.6136413   2.6136413
## PC63                    2.3920426   2.3920426
## PC1                     2.2036273   2.2036273
## PC80                    0.6168736   0.6168736
## PC82                    0.4524957   0.4524957
## PC8                     0.0000000   0.0000000
## PC10                    0.0000000   0.0000000
## PC11                    0.0000000   0.0000000
## PC12                    0.0000000   0.0000000
## PC15                    0.0000000   0.0000000
## PC16                    0.0000000   0.0000000
## PC18                    0.0000000   0.0000000
## PC19                    0.0000000   0.0000000
## PC20                    0.0000000   0.0000000
## PC21                    0.0000000   0.0000000
## PC22                    0.0000000   0.0000000
## PC23                    0.0000000   0.0000000
## PC27                    0.0000000   0.0000000
## PC29                    0.0000000   0.0000000
## PC30                    0.0000000   0.0000000
## PC31                    0.0000000   0.0000000
## PC32                    0.0000000   0.0000000
## PC33                    0.0000000   0.0000000
## PC35                    0.0000000   0.0000000
## PC36                    0.0000000   0.0000000
## PC37                    0.0000000   0.0000000
## PC38                    0.0000000   0.0000000
## PC39                    0.0000000   0.0000000
## PC40                    0.0000000   0.0000000
## PC42                    0.0000000   0.0000000
## PC44                    0.0000000   0.0000000
## PC45                    0.0000000   0.0000000
## PC46                    0.0000000   0.0000000
## PC47                    0.0000000   0.0000000
## PC48                    0.0000000   0.0000000
## PC49                    0.0000000   0.0000000
## PC50                    0.0000000   0.0000000
## PC51                    0.0000000   0.0000000
## PC52                    0.0000000   0.0000000
## PC53                    0.0000000   0.0000000
## PC54                    0.0000000   0.0000000
## PC55                    0.0000000   0.0000000
## PC56                    0.0000000   0.0000000
## PC57                    0.0000000   0.0000000
## PC58                    0.0000000   0.0000000
## PC59                    0.0000000   0.0000000
## PC60                    0.0000000   0.0000000
## PC61                    0.0000000   0.0000000
## PC62                    0.0000000   0.0000000
## PC64                    0.0000000   0.0000000
## PC65                    0.0000000   0.0000000
## PC66                    0.0000000   0.0000000
## PC67                    0.0000000   0.0000000
## PC69                    0.0000000   0.0000000
## PC70                    0.0000000   0.0000000
## PC71                    0.0000000   0.0000000
## PC72                    0.0000000   0.0000000
## PC73                    0.0000000   0.0000000
## PC74                    0.0000000   0.0000000
## PC75                    0.0000000   0.0000000
## PC76                    0.0000000   0.0000000
## PC77                    0.0000000   0.0000000
## PC78                    0.0000000   0.0000000
## PC79                    0.0000000   0.0000000
## PC81                    0.0000000   0.0000000
## PC83                    0.0000000   0.0000000
## PC84                    0.0000000   0.0000000
## PC85                    0.0000000   0.0000000
## PC86                    0.0000000   0.0000000
## PC87                    0.0000000   0.0000000
## PC88                    0.0000000   0.0000000
## PC89                    0.0000000   0.0000000
## PC90                    0.0000000   0.0000000
## PC91                    0.0000000   0.0000000
## PC92                    0.0000000   0.0000000
## PC93                    0.0000000   0.0000000
## PC95                    0.0000000   0.0000000
## PC96                    0.0000000   0.0000000
## PC97                    0.0000000   0.0000000
## PC98                    0.0000000   0.0000000
## PC99                    0.0000000   0.0000000
## PC100                   0.0000000   0.0000000
## PC101                   0.0000000   0.0000000
## PC102                   0.0000000   0.0000000
## PC103                   0.0000000   0.0000000
## PC104                   0.0000000   0.0000000
## PC105                   0.0000000   0.0000000
## PC107                   0.0000000   0.0000000
## PC108                   0.0000000   0.0000000
## PC109                   0.0000000   0.0000000
## PC110                   0.0000000   0.0000000
## PC111                   0.0000000   0.0000000
## PC112                   0.0000000   0.0000000
## PC114                   0.0000000   0.0000000
## PC115                   0.0000000   0.0000000
## PC116                   0.0000000   0.0000000
## PC117                   0.0000000   0.0000000
## PC118                   0.0000000   0.0000000
## PC122                   0.0000000   0.0000000
## PC123                   0.0000000   0.0000000
## PC124                   0.0000000   0.0000000
## PC125                   0.0000000   0.0000000
## PC126                   0.0000000   0.0000000
## PC127                   0.0000000   0.0000000
## PC128                   0.0000000   0.0000000
## PC129                   0.0000000   0.0000000
## PC130                   0.0000000   0.0000000
## PC131                   0.0000000   0.0000000
## PC132                   0.0000000   0.0000000
## PC134                   0.0000000   0.0000000
## PC135                   0.0000000   0.0000000
## PC136                   0.0000000   0.0000000
## PC137                   0.0000000   0.0000000
## PC138                   0.0000000   0.0000000
## PC139                   0.0000000   0.0000000
## Warning in glb_analytics_diag_plots(obs_df = glbObsOOB, mdl_id =
## glbMdlSelId, : Limiting important feature scatter plots to 5 out of 139

## Loading required package: lazyeval

## [1] "Min/Max Boundaries: "
##   USER_ID Party.fctr Party.fctr.All.X.zv.pca.rcv.glmnet.prob
## 1    5089          R                               0.4755231
## 2    2269          R                               0.4933153
## 3    3264          R                               0.6273233
## 4    5525          R                               0.6187544
##   Party.fctr.All.X.zv.pca.rcv.glmnet
## 1                                  D
## 2                                  D
## 3                                  R
## 4                                  R
##   Party.fctr.All.X.zv.pca.rcv.glmnet.err
## 1                                   TRUE
## 2                                   TRUE
## 3                                  FALSE
## 4                                  FALSE
##   Party.fctr.All.X.zv.pca.rcv.glmnet.err.abs
## 1                                  0.5244769
## 2                                  0.5066847
## 3                                  0.3726767
## 4                                  0.3812456
##   Party.fctr.All.X.zv.pca.rcv.glmnet.is.acc
## 1                                     FALSE
## 2                                     FALSE
## 3                                      TRUE
## 4                                      TRUE
##   Party.fctr.All.X.zv.pca.rcv.glmnet.accurate
## 1                                       FALSE
## 2                                       FALSE
## 3                                        TRUE
## 4                                        TRUE
##   Party.fctr.All.X.zv.pca.rcv.glmnet.error .label
## 1                             -0.024476896   5089
## 2                             -0.006684666   2269
## 3                              0.000000000   3264
## 4                              0.000000000   5525
## [1] "Inaccurate: "
##   USER_ID Party.fctr Party.fctr.All.X.zv.pca.rcv.glmnet.prob
## 1    2747          R                               0.4063995
## 2    4017          R                               0.4257475
## 3    4282          R                               0.4414884
## 4    3985          R                               0.4422734
## 5    4737          R                               0.4509761
## 6    2928          R                               0.4631504
##   Party.fctr.All.X.zv.pca.rcv.glmnet
## 1                                  D
## 2                                  D
## 3                                  D
## 4                                  D
## 5                                  D
## 6                                  D
##   Party.fctr.All.X.zv.pca.rcv.glmnet.err
## 1                                   TRUE
## 2                                   TRUE
## 3                                   TRUE
## 4                                   TRUE
## 5                                   TRUE
## 6                                   TRUE
##   Party.fctr.All.X.zv.pca.rcv.glmnet.err.abs
## 1                                  0.5936005
## 2                                  0.5742525
## 3                                  0.5585116
## 4                                  0.5577266
## 5                                  0.5490239
## 6                                  0.5368496
##   Party.fctr.All.X.zv.pca.rcv.glmnet.is.acc
## 1                                     FALSE
## 2                                     FALSE
## 3                                     FALSE
## 4                                     FALSE
## 5                                     FALSE
## 6                                     FALSE
##   Party.fctr.All.X.zv.pca.rcv.glmnet.accurate
## 1                                       FALSE
## 2                                       FALSE
## 3                                       FALSE
## 4                                       FALSE
## 5                                       FALSE
## 6                                       FALSE
##   Party.fctr.All.X.zv.pca.rcv.glmnet.error
## 1                              -0.09360053
## 2                              -0.07425254
## 3                              -0.05851165
## 4                              -0.05772659
## 5                              -0.04902390
## 6                              -0.03684957
##     USER_ID Party.fctr Party.fctr.All.X.zv.pca.rcv.glmnet.prob
## 14     5089          R                               0.4755231
## 31     3798          D                               0.5012708
## 52     3052          D                               0.5173960
## 57     2436          D                               0.5229845
## 146     551          D                               0.6106212
## 168     736          D                               0.6575981
##     Party.fctr.All.X.zv.pca.rcv.glmnet
## 14                                   D
## 31                                   R
## 52                                   R
## 57                                   R
## 146                                  R
## 168                                  R
##     Party.fctr.All.X.zv.pca.rcv.glmnet.err
## 14                                    TRUE
## 31                                    TRUE
## 52                                    TRUE
## 57                                    TRUE
## 146                                   TRUE
## 168                                   TRUE
##     Party.fctr.All.X.zv.pca.rcv.glmnet.err.abs
## 14                                   0.5244769
## 31                                   0.5012708
## 52                                   0.5173960
## 57                                   0.5229845
## 146                                  0.6106212
## 168                                  0.6575981
##     Party.fctr.All.X.zv.pca.rcv.glmnet.is.acc
## 14                                      FALSE
## 31                                      FALSE
## 52                                      FALSE
## 57                                      FALSE
## 146                                     FALSE
## 168                                     FALSE
##     Party.fctr.All.X.zv.pca.rcv.glmnet.accurate
## 14                                        FALSE
## 31                                        FALSE
## 52                                        FALSE
## 57                                        FALSE
## 146                                       FALSE
## 168                                       FALSE
##     Party.fctr.All.X.zv.pca.rcv.glmnet.error
## 14                              -0.024476896
## 31                               0.001270812
## 52                               0.017396038
## 57                               0.022984454
## 146                              0.110621163
## 168                              0.157598132
##     USER_ID Party.fctr Party.fctr.All.X.zv.pca.rcv.glmnet.prob
## 192      66          D                               0.7203822
## 193    5452          D                               0.7205011
## 194    3578          D                               0.7220880
## 195     217          D                               0.7349403
## 196    1339          D                               0.7546262
## 197    1064          D                               0.7662756
##     Party.fctr.All.X.zv.pca.rcv.glmnet
## 192                                  R
## 193                                  R
## 194                                  R
## 195                                  R
## 196                                  R
## 197                                  R
##     Party.fctr.All.X.zv.pca.rcv.glmnet.err
## 192                                   TRUE
## 193                                   TRUE
## 194                                   TRUE
## 195                                   TRUE
## 196                                   TRUE
## 197                                   TRUE
##     Party.fctr.All.X.zv.pca.rcv.glmnet.err.abs
## 192                                  0.7203822
## 193                                  0.7205011
## 194                                  0.7220880
## 195                                  0.7349403
## 196                                  0.7546262
## 197                                  0.7662756
##     Party.fctr.All.X.zv.pca.rcv.glmnet.is.acc
## 192                                     FALSE
## 193                                     FALSE
## 194                                     FALSE
## 195                                     FALSE
## 196                                     FALSE
## 197                                     FALSE
##     Party.fctr.All.X.zv.pca.rcv.glmnet.accurate
## 192                                       FALSE
## 193                                       FALSE
## 194                                       FALSE
## 195                                       FALSE
## 196                                       FALSE
## 197                                       FALSE
##     Party.fctr.All.X.zv.pca.rcv.glmnet.error
## 192                                0.2203822
## 193                                0.2205011
## 194                                0.2220880
## 195                                0.2349403
## 196                                0.2546262
## 197                                0.2662756

##     Q115611.fctr .n.OOB .n.Fit .n.Tst .freqRatio.Fit .freqRatio.OOB
## NA            NA     85    295    107      0.1502037      0.1717172
## No            No    218    975    274      0.4964358      0.4404040
## Yes          Yes    192    694    241      0.3533605      0.3878788
##     .freqRatio.Tst err.abs.fit.sum err.abs.fit.mean .n.fit err.abs.OOB.sum
## NA       0.1720257        140.7311        0.4770547    295        41.44707
## No       0.4405145        471.2857        0.4833699    975       103.54512
## Yes      0.3874598        305.9325        0.4408249    694        90.49694
##     err.abs.OOB.mean
## NA         0.4876126
## No         0.4749776
## Yes        0.4713382
##           .n.OOB           .n.Fit           .n.Tst   .freqRatio.Fit 
##       495.000000      1964.000000       622.000000         1.000000 
##   .freqRatio.OOB   .freqRatio.Tst  err.abs.fit.sum err.abs.fit.mean 
##         1.000000         1.000000       917.949305         1.401250 
##           .n.fit  err.abs.OOB.sum err.abs.OOB.mean 
##      1964.000000       235.489136         1.433928
##              label step_major step_minor label_minor     bgn end elapsed
## 1 fit.models_2_bgn          1          0    teardown 1157.77  NA      NA
##        label step_major step_minor label_minor      bgn     end elapsed
## 2 fit.models          1          1           1 1097.568 1157.78  60.212
## 3 fit.models          1          2           2 1157.781      NA      NA
# if (sum(is.na(glbObsAll$D.P.http)) > 0)
#         stop("fit.models_3: Why is this happening ?")

#stop(here"); glb2Sav()
sync_glb_obs_df <- function() {
    # Merge or cbind ?
    for (col in setdiff(names(glbObsFit), names(glbObsTrn)))
        glbObsTrn[glbObsTrn$.lcn == "Fit", col] <<- glbObsFit[, col]
    for (col in setdiff(names(glbObsFit), names(glbObsAll)))
        glbObsAll[glbObsAll$.lcn == "Fit", col] <<- glbObsFit[, col]
    if (all(is.na(glbObsNew[, glb_rsp_var])))
        for (col in setdiff(names(glbObsOOB), names(glbObsTrn)))
            glbObsTrn[glbObsTrn$.lcn == "OOB", col] <<- glbObsOOB[, col]
    for (col in setdiff(names(glbObsOOB), names(glbObsAll)))
        glbObsAll[glbObsAll$.lcn == "OOB", col] <<- glbObsOOB[, col]
}
sync_glb_obs_df()
    
print(setdiff(names(glbObsNew), names(glbObsAll)))
## character(0)
replay.petrisim(pn = glb_analytics_pn, 
    replay.trans = (glb_analytics_avl_objs <- c(glb_analytics_avl_objs, 
        "model.selected")), flip_coord = TRUE)
## time trans    "bgn " "fit.data.training.all " "predict.data.new " "end " 
## 0.0000   multiple enabled transitions:  data.training.all data.new model.selected    firing:  model.selected 
## 1.0000    3   2 1 0 0

glb_chunks_df <- myadd_chunk(glb_chunks_df, "fit.data.training", major.inc = TRUE)
##               label step_major step_minor label_minor      bgn      end
## 3        fit.models          1          2           2 1157.781 1160.832
## 4 fit.data.training          2          0           0 1160.832       NA
##   elapsed
## 3   3.051
## 4      NA

Step 2.0: fit data training

#load(paste0(glb_inp_pfx, "dsk.RData"))

if (!is.null(glbMdlFinId) && (glbMdlFinId %in% names(glb_models_lst))) {
    warning("Final model same as user selected model")
    glb_fin_mdl <- glb_models_lst[[glbMdlFinId]]
} else 
# if (nrow(glbObsFit) + length(glbObsFitOutliers) == nrow(glbObsTrn))
if (!all(is.na(glbObsNew[, glb_rsp_var]))) {    
    warning("Final model same as glbMdlSelId")
    glbMdlFinId <- paste0("Final.", glbMdlSelId)
    glb_fin_mdl <- glb_sel_mdl
    glb_models_lst[[glbMdlFinId]] <- glb_fin_mdl
    mdlDf <- glb_models_df[glb_models_df$id == glbMdlSelId, ]
    mdlDf$id <- glbMdlFinId
    glb_models_df <- rbind(glb_models_df, mdlDf)
} else {    
    if (myparseMdlId(glbMdlSelId)$family == "RFE.X") {
        indepVar <- mygetIndepVar(glb_feats_df)
        trnRFEResults <- 
            myrun_rfe(glbObsTrn, indepVar, glbRFESizes[["Final"]])
        if (!isTRUE(all.equal(sort(predictors(trnRFEResults)),
                              sort(predictors(glbRFEResults))))) {
            print("Diffs predictors(trnRFEResults) vs. predictors(glbRFEResults):")
            print(setdiff(predictors(trnRFEResults), predictors(glbRFEResults)))
            print("Diffs predictors(glbRFEResults) vs. predictors(trnRFEResults):")
            print(setdiff(predictors(glbRFEResults), predictors(trnRFEResults)))
        }
    }

    if (grepl("Ensemble", glbMdlSelId)) {
        # Find which models are relevant
        mdlimp_df <- subset(myget_feats_importance(glb_sel_mdl), imp > 5)
        mdlIndepVar <- row.names(mdlimp_df)
        if (glb_is_classification)
            mdlIdVcr <- glbMdlEnsemble[sapply(glbMdlEnsemble, function(thsMdlId)
                            mygetPredictIds(glb_rsp_var, thsMdlId)$prob  %in% mdlIndepVar)] else
            mdlIdVcr <- glbMdlEnsemble[sapply(glbMdlEnsemble, function(thsMdlId)
                            mygetPredictIds(glb_rsp_var, thsMdlId)$value %in% mdlIndepVar)]
        # Fit selected models on glbObsTrn
        for (mdl_id in mdlIdVcr) {
            mdl_id_components <- myparseMdlId(mdl_id)
            mdlIdPfx <- mdl_id_components$family
            # if (grepl("RFE\\.X\\.", mdlIdPfx)) 
            #     mdlIndepVars <- myadjustInteractionFeats(glb_feats_df, myextract_actual_feats(
            #         predictors(trnRFEResults))) else
                # mdlIndepVars <- trim(unlist(
                #     strsplit(glb_models_df[glb_models_df$id == mdl_id, "feats"], "[,]")))
            thsIndepVar <- unlist(
                    strsplit(glb_models_df[glb_models_df$id == mdl_id, "feats"], "[,]"))
            thsSpc <- myinit_mdl_specs_lst(mdl_specs_lst = list(
                        id.prefix = paste0("Final.", mdlIdPfx), 
                        type = glb_model_type, tune.df = glbMdlTuneParams,
                        trainControl.method = mdl_id_components$resample,
                        trainControl.number = glb_rcv_n_folds,
                        trainControl.repeats = glb_rcv_n_repeats,
                        trainControl.classProbs = glb_is_classification,
                        trainControl.summaryFunction = glbMdlMetricSummaryFn,
                        trainControl.allowParallel = glbMdlAllowParallel,
                        train.metric = glbMdlMetricSummary, 
                        train.maximize = glbMdlMetricMaximize,    
                        train.method = mdl_id_components$alg,
                        train.preProcess = mdl_id_components$preProcess))
            ret_lst <- myfit_mdl(mdl_specs_lst = thsSpc,
                    indepVar = thsIndepVar,
                    rsp_var = glb_rsp_var, 
                    fit_df = glbObsTrn, OOB_df = NULL)
            
            glbObsTrn <- glb_get_predictions(df = glbObsTrn,
                                                mdl_id = thsSpc$id, 
                                                rsp_var = glb_rsp_var,
                                                prob_threshold_def = 
                    subset(glb_models_df, id == mdl_id)$opt.prob.threshold.OOB)
            glbObsNew <- glb_get_predictions(df = glbObsNew,
                                                mdl_id = thsSpc$id, 
                                                rsp_var = glb_rsp_var,
                                                prob_threshold_def = 
                    subset(glb_models_df, id == mdl_id)$opt.prob.threshold.OOB)
        }    
    }
    
    # "Final" model
    if ((model_method <- glb_sel_mdl$method) == "custom")
        # get actual method from the mdl_id
        model_method <- tail(unlist(strsplit(glbMdlSelId, "[.]")), 1)
        
    if (grepl("Ensemble", glbMdlSelId)) {
        # Find which models are relevant
        mdlimp_df <- subset(myget_feats_importance(glb_sel_mdl), imp > 5)
        mdlIndepVar <- row.names(mdlimp_df)        
        if (glb_is_classification)
            mdlIdVcr <- glbMdlEnsemble[sapply(glbMdlEnsemble, function(thsMdlId)
                            mygetPredictIds(glb_rsp_var, thsMdlId)$prob  %in% mdlIndepVar)] else
            mdlIdVcr <- glbMdlEnsemble[sapply(glbMdlEnsemble, function(thsMdlId)
                            mygetPredictIds(glb_rsp_var, thsMdlId)$value %in% mdlIndepVar)]
        mdlIdVcr <- paste("Final", mdlIdVcr, sep = ".")
        mdlIndepVar <- gsub(glb_rsp_var, paste0(glb_rsp_var, ".Final"), mdlIndepVar, fixed = TRUE)
        
        # if (glb_is_classification && glb_is_binomial)
        #     indepVar <- gsub("(.*)\\.(.*)\\.prob", "\\1\\.Train\\.\\2\\.prob",
        #                             row.names(mdlimp_df)) else
        #     indepVar <- gsub("(.*)\\.(.*)", "\\1\\.Train\\.\\2",
        #                             row.names(mdlimp_df))
    } else 
    if (grepl("RFE.X", glbMdlSelId, fixed = TRUE)) {
        # indepVar <- myextract_actual_feats(predictors(trnRFEResults))
        mdlIndepVar <- myextract_actual_feats(predictors(glbRFEResults))        
    } else mdlIndepVar <- 
                trim(unlist(strsplit(glb_models_df[glb_models_df$id ==
                                                   glbMdlSelId
                                                   , "feats"], "[,]")))
        
    # if (!is.null(glbMdlPreprocMethods) &&
    #     ((match_pos <- regexpr(gsub(".", "\\.", 
    #                                 paste(glbMdlPreprocMethods, collapse = "|"),
    #                                fixed = TRUE), glbMdlSelId)) != -1))
    #     ths_preProcess <- str_sub(glbMdlSelId, match_pos, 
    #                             match_pos + attr(match_pos, "match.length") - 1) else
    #     ths_preProcess <- NULL   
    
    # mdl_id_pfx <- ifelse(grepl("Ensemble", glbMdlSelId),
    #                                "Final.Ensemble", "Final")
    thsMdlId <- paste0("Final.", glbMdlSelId)
    thsMdlIdComponents <- myparseMdlId(thsMdlId)
    # mdl_id_pfx <- paste("Final", myparseMdlId(glbMdlSelId)$family, sep = ".")
    mdl_id_pfx <- thsMdlIdComponents$family
    
    trnobs_df <- glbObsTrn 
    if (!is.null(glbObsTrnOutliers[[mdl_id_pfx]])) {
        trnobs_df <- glbObsTrn[!(glbObsTrn[, glbFeatsId] %in% glbObsTrnOutliers[[mdl_id_pfx]]), ]
        print(sprintf("Outliers removed: %d", nrow(glbObsTrn) - nrow(trnobs_df)))
        print(setdiff(glbObsTrn[, glbFeatsId], trnobs_df[, glbFeatsId]))
    }    
        
    # Force fitting of Final.glm to identify outliers
    # method_vctr <- unique(c(myparseMdlId(glbMdlSelId)$alg, glbMdlFamilies[["Final"]]))

    thsSpc <- myinit_mdl_specs_lst(mdl_specs_lst = list(
        id.prefix = mdl_id_pfx, 
        type = glb_model_type, tune.df = glbMdlTuneParams,
        trainControl.method = thsMdlIdComponents$resample,
        trainControl.number = glb_rcv_n_folds,
        trainControl.repeats = glb_rcv_n_repeats,
        trainControl.classProbs = glb_is_classification,
        trainControl.summaryFunction = glbMdlMetricSummaryFn,
        trainControl.allowParallel = glbMdlAllowParallel,
        train.metric = glbMdlMetricSummary, 
        train.maximize = glbMdlMetricMaximize,    
        train.method = thsMdlIdComponents$alg,
        train.preProcess = thsMdlIdComponents$preProcess))

    glbMdlFinId <- thsSpc$id
    if (!(grepl("Ensemble", glbMdlSelId)))
        ret_lst <- myfit_mdl(mdl_specs_lst = thsSpc,
                             indepVar = mdlIndepVar,
                             rsp_var = glb_rsp_var, 
                             fit_df = glbObsTrn, OOB_df = NULL) else {
                                 
        # Final model same as selected model except for the model features
        tmp_models_df <- glb_models_df[glb_models_df$id == glbMdlSelId, ]
        tmp_models_df$id <- paste0("Final.", tmp_models_df$id)
        row.names(tmp_models_df) <- tmp_models_df$id
        tmp_models_df$feats <- gsub(glb_rsp_var, paste0(glb_rsp_var, ".Final"),
                                    tmp_models_df$feats, fixed = TRUE)
        glb_models_df <- rbind(glb_models_df, tmp_models_df)
        
        tmp_fin_mdl <- glb_sel_mdl
        # tmp_fin_mdl$coefnames <- gsub(glb_rsp_var, paste0(glb_rsp_var, ".Final"),
        #                               tmp_fin_mdl$coefnames, fixed = TRUE)
        # dimnames(tmp_fin_mdl$finalModel$beta)[[1]] <- 
        #     gsub(glb_rsp_var, paste0(glb_rsp_var, ".Final"),
        #         dimnames(tmp_fin_mdl$finalModel$beta)[[1]], fixed = TRUE)
        # tmp_fin_mdl$finalModel$xNames <- 
        #     gsub(glb_rsp_var, paste0(glb_rsp_var, ".Final"),
        #         tmp_fin_mdl$finalModel$xNames, fixed = TRUE)
        # 
        # thsAts <- attributes(tmp_fin_mdl$terms)
        # # thsAts$variables <- class == "call" & objects / symbols are stored as a formula
        # thsAts$term.labels <- 
        #     gsub(glb_rsp_var, paste0(glb_rsp_var, ".Final"),
        #         thsAts$term.labels, fixed = TRUE)
        # attributes(tmp_fin_mdl$terms) <- thsAts
        # 
        glb_models_lst[[glbMdlFinId]] <- tmp_fin_mdl
    }
    
    glb_fin_mdl <- glb_models_lst[[glbMdlFinId]] 
}

rm(ret_lst)
glb_chunks_df <- myadd_chunk(glb_chunks_df, "fit.data.training", major.inc=FALSE)
#stop(here"); glb2Sav()
if (glb_is_classification && glb_is_binomial) 
    prob_threshold <- glb_models_df[glb_models_df$id == glbMdlSelId,
                                        "opt.prob.threshold.OOB"] else 
    prob_threshold <- NULL

if (grepl("Ensemble", glbMdlFinId)) {
    # Get predictions for each model in ensemble; Outliers that have been moved to OOB might not have been predicted yet
    mdlEnsembleComps <- unlist(str_split(subset(glb_models_df, 
                                                id == glbMdlFinId)$feats, ","))
    if (glb_is_classification)
    #     mdlEnsembleComps <- gsub("\\.prob$", "", mdlEnsembleComps)
    # mdlEnsembleComps <- gsub(paste0("^", 
    #                     gsub(".", "\\.", mygetPredictIds(glb_rsp_var)$value, fixed = TRUE)),
    #                          "", mdlEnsembleComps)
        mdlEnsembleComps <- glb_models_df$id[sapply(glb_models_df$id, function(thsMdlId)
                        mygetPredictIds(glb_rsp_var, thsMdlId)$prob  %in% mdlEnsembleComps)] else
        mdlEnsembleComps <- glb_models_df$id[sapply(glb_models_df$id, function(thsMdlId)
                        mygetPredictIds(glb_rsp_var, thsMdlId)$value  %in% mdlEnsembleComps)]
                        
    for (mdl_id in mdlEnsembleComps) {
        glbObsTrn <- glb_get_predictions(df = glbObsTrn, mdl_id = mdl_id, 
                                            rsp_var = glb_rsp_var,
                                            prob_threshold_def = prob_threshold)
        glbObsNew <- glb_get_predictions(df = glbObsNew, mdl_id = mdl_id, 
                                            rsp_var = glb_rsp_var,
                                            prob_threshold_def = prob_threshold)
        # glb_fin_mdl uses the same coefficients as glb_sel_mdl, 
        #   so copy the "Final" columns into "non-Final" columns
        glbObsTrn[, gsub("Final.", "", unlist(mygetPredictIds(glb_rsp_var, mdl_id)))] <-
            glbObsTrn[, unlist(mygetPredictIds(glb_rsp_var, mdl_id))]
        glbObsNew[, gsub("Final.", "", unlist(mygetPredictIds(glb_rsp_var, mdl_id)))] <-
            glbObsNew[, unlist(mygetPredictIds(glb_rsp_var, mdl_id))]
    }    
}
glbObsTrn <- glb_get_predictions(df = glbObsTrn, mdl_id = glbMdlFinId, 
                                     rsp_var = glb_rsp_var,
                                    prob_threshold_def = prob_threshold)

glb_featsimp_df <- myget_feats_importance(mdl=glb_fin_mdl,
                                          featsimp_df=glb_featsimp_df)
#glb_featsimp_df[, paste0(glbMdlFinId, ".imp")] <- glb_featsimp_df$imp
print(glb_featsimp_df)
if (glb_is_classification && glb_is_binomial)
    glb_analytics_diag_plots(obs_df=glbObsTrn, mdl_id=glbMdlFinId, 
            prob_threshold=glb_models_df[glb_models_df$id == glbMdlSelId, 
                                         "opt.prob.threshold.OOB"]) else
    glb_analytics_diag_plots(obs_df=glbObsTrn, mdl_id=glbMdlFinId)                  

dsp_feats_vctr <- c(NULL)
for(var in grep(".imp", names(glb_feats_df), fixed=TRUE, value=TRUE))
    dsp_feats_vctr <- union(dsp_feats_vctr, 
                            glb_feats_df[!is.na(glb_feats_df[, var]), "id"])

# print(glbObsTrn[glbObsTrn$UniqueID %in% FN_OOB_ids, 
#                     grep(glb_rsp_var, names(glbObsTrn), value=TRUE)])

print(setdiff(names(glbObsTrn), names(glbObsAll)))
for (col in setdiff(names(glbObsTrn), names(glbObsAll)))
    # Merge or cbind ?
    glbObsAll[glbObsAll$.src == "Train", col] <- glbObsTrn[, col]

print(setdiff(names(glbObsFit), names(glbObsAll)))
print(setdiff(names(glbObsOOB), names(glbObsAll)))
for (col in setdiff(names(glbObsOOB), names(glbObsAll)))
    # Merge or cbind ?
    glbObsAll[glbObsAll$.lcn == "OOB", col] <- glbObsOOB[, col]
    
print(setdiff(names(glbObsNew), names(glbObsAll)))

#glb2Sav(); all.equal(savObsAll, glbObsAll); all.equal(sav_models_lst, glb_models_lst)
#load(file = paste0(glbOut$pfx, "dsk_knitr.RData"))
#cmpCols <- names(glbObsAll)[!grepl("\\.Final\\.", names(glbObsAll))]; all.equal(savObsAll[, cmpCols], glbObsAll[, cmpCols]); all.equal(savObsAll[, "H.P.http"], glbObsAll[, "H.P.http"]); 

replay.petrisim(pn = glb_analytics_pn, 
    replay.trans = (glb_analytics_avl_objs <- c(glb_analytics_avl_objs, 
        "data.training.all.prediction","model.final")), flip_coord = TRUE)
glb_chunks_df <- myadd_chunk(glb_chunks_df, "predict.data.new", major.inc = TRUE)

Step 2.0: fit data training

Null Hypothesis (\(\sf{H_{0}}\)): mpg is not impacted by am_fctr.
The variance by am_fctr appears to be independent. #{r q1, cache=FALSE} # print(t.test(subset(cars_df, am_fctr == "automatic")$mpg, # subset(cars_df, am_fctr == "manual")$mpg, # var.equal=FALSE)$conf) # We reject the null hypothesis i.e. we have evidence to conclude that am_fctr impacts mpg (95% confidence). Manual transmission is better for miles per gallon versus automatic transmission.

##          label step_major step_minor label_minor      bgn      end
## 1 fit.models_1          1          0           0    9.489 1097.568
## 2   fit.models          1          1           1 1097.568 1157.780
## 3   fit.models          1          2           2 1157.781 1160.832
##    elapsed duration
## 1 1088.079 1088.079
## 2   60.212   60.212
## 3    3.051    3.051
## [1] "Total Elapsed Time: 1,160.832 secs"

##                  label step_major step_minor label_minor    bgn      end
## 4 fit.models_1_preProc          1          3     preProc 38.976 1097.558
## 3   fit.models_1_All.X          1          2      glmnet 12.142   38.975
## 2   fit.models_1_All.X          1          1       setup 11.917   12.142
## 1     fit.models_1_bgn          1          0       setup 11.909   11.917
##    elapsed duration
## 4 1058.582 1058.582
## 3   26.833   26.833
## 2    0.225    0.225
## 1    0.008    0.008
## [1] "Total Elapsed Time: 1,097.558 secs"